File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Test/UnitTests/TestSupport Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1+ using System ;
12using System . Linq ;
23using System . Reflection ;
4+ using Microsoft . EntityFrameworkCore ;
35using TestSupport . Helpers ;
46using Xunit . Extensions . AssertExtensions ;
57using Xunit ;
@@ -20,6 +22,19 @@ public void TestGetCallerTopLevelDirectory()
2022 path . ShouldEndWith ( this . GetType ( ) . Namespace . Split ( '.' ) . First ( ) ) ;
2123 }
2224
25+
26+ [ Fact ]
27+ public void TestGetCallerTopLevelDirectoryNuGetAssembly ( )
28+ {
29+ //SETUP
30+
31+ //ATTEMPT
32+ var ex = Assert . Throws < Exception > ( ( ) => TestData . GetCallingAssemblyTopLevelDir ( Assembly . GetAssembly ( typeof ( DbContext ) ) ) ) ;
33+
34+ //VERIFY
35+ ex . Message . ShouldEqual ( @"Did not find '\bin\' in the assembly. Do you need to provide the callingAssembly parameter?" ) ;
36+ }
37+
2338 [ Fact ]
2439 public void TestGetTestDataFileDirectory ( )
2540 {
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ public static string GetCallingAssemblyTopLevelDir(Assembly callingAssembly = nu
141141
142142 var indexOfPart = pathToManipulate . IndexOf ( binDir , StringComparison . OrdinalIgnoreCase ) + 1 ;
143143 if ( indexOfPart <= 0 )
144- throw new Exception ( $ "Did not find '{ binDir } ' in the ApplicationBasePath ") ;
144+ throw new Exception ( $ "Did not find '{ binDir } ' in the assembly. Do you need to provide the callingAssembly parameter? ") ;
145145
146146 return pathToManipulate . Substring ( 0 , indexOfPart - 1 ) ;
147147 }
You can’t perform that action at this time.
0 commit comments