public void InitializeShouldReportIfNoTestAdaptersFoundInPath() { var mockTestPlatform = new Mock <ITestPlatform>(); var mockOutput = new Mock <IOutput>(); var executor = new TestableTestAdapterPathArgumentExecutor(CommandLineOptions.Instance, mockTestPlatform.Object, mockOutput.Object, new FileHelper()); var currentAssemblyPath = typeof(TestAdapterPathArgumentExecutor).GetTypeInfo().Assembly.Location; var currentFolder = Path.GetDirectoryName(currentAssemblyPath); executor.TestAdapters = (directory) => { return(new List <string> { }); }; executor.Initialize(currentFolder); mockOutput.Verify( o => o.WriteLine( string.Format( "The path '{0}' specified in the 'TestAdapterPath' does not contain any test adapters, provide a valid path and try again.", currentFolder), OutputLevel.Warning)); }
public void InitializeShouldUpdateAdditionalExtensionsWithTestAdapterPath() { var mockTestPlatform = new Mock <ITestPlatform>(); var mockOutput = new Mock <IOutput>(); var executor = new TestableTestAdapterPathArgumentExecutor(CommandLineOptions.Instance, mockTestPlatform.Object, mockOutput.Object, new FileHelper()); var currentAssemblyPath = typeof(TestAdapterPathArgumentExecutor).GetTypeInfo().Assembly.Location; var currentFolder = Path.GetDirectoryName(currentAssemblyPath); executor.TestAdapters = (directory) => { if (string.Equals(directory, currentFolder)) { return(new List <string> { typeof(TestAdapterPathArgumentExecutor).GetTypeInfo() .Assembly.Location }); } return(new List <string> { }); }; executor.Initialize(currentFolder); mockTestPlatform.Verify(tp => tp.UpdateExtensions(new List <string> { currentAssemblyPath }, false), Times.Once); }