public void FileExtensionsShouldReturnSupportedFileExtensionsForADiscoverer() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovererWithTwoFileExtensions)); CollectionAssert.AreEqual(new List <string> { "csv", "docx" }, this.testPluginInformation.FileExtensions); }
public void MetadataShouldReturnMetadataSpecified() { var testDiscovererPluginInfo = new TestDiscovererPluginInformation(typeof(DummyExtension)); var mockMetadata = new Mock <ITestDiscovererCapabilities>(); LazyExtension <ITestDiscoverer, ITestDiscovererCapabilities> extension = new LazyExtension <ITestDiscoverer, ITestDiscovererCapabilities>( testDiscovererPluginInfo, mockMetadata.Object); Assert.AreEqual(mockMetadata.Object, extension.Metadata); }
public void ValueShouldCreateExtensionViaTestPluginManager() { var testDiscovererPluginInfo = new TestDiscovererPluginInformation(typeof(DummyExtension)); LazyExtension <ITestDiscoverer, ITestDiscovererCapabilities> extension = new LazyExtension <ITestDiscoverer, ITestDiscovererCapabilities>( testDiscovererPluginInfo, new Mock <ITestDiscovererCapabilities>().Object); Assert.IsNotNull(extension.Value); Assert.AreEqual(typeof(DummyExtension), extension.Value.GetType()); }
public void GetTestExtensionsInformationShouldNotConsiderAbstractClasses() { var pathToExtensions = new List <string> { typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location }; // The below should not throw an exception. var testExtensions = this.testPluginDiscoverer.GetTestExtensionsInformation <TestDiscovererPluginInformation, ITestDiscoverer>(pathToExtensions); var discovererPluginInformation = new TestDiscovererPluginInformation(typeof(AbstractTestDiscoverer)); Assert.IsFalse(testExtensions.ContainsKey(discovererPluginInformation.IdentifierData)); }
public void MetadataShouldReturnFileExtensionsAndDefaultExecutorUri() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovererWithTwoFileExtensions)); var expectedFileExtensions = new List <string> { "csv", "docx" }; var testPluginMetada = this.testPluginInformation.Metadata.ToArray(); CollectionAssert.AreEqual(expectedFileExtensions, (testPluginMetada[0] as List <string>).ToArray()); Assert.AreEqual("csvexecutor", testPluginMetada[1] as string); }
public void GetTestExtensionsInformationShouldNotListADiscovererExtensionAsAnotherExtensionType() { var pathToExtensions = new List <string> { typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location }; // The below should not throw an exception. var testExtensions = this.testPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions, loadOnlyWellKnownExtensions: true); var discovererPluginInformation = new TestDiscovererPluginInformation(typeof(ValidDiscoverer)); Assert.IsFalse(testExtensions.TestExecutors.ContainsKey(discovererPluginInformation.IdentifierData)); Assert.IsFalse(testExtensions.TestLoggers.ContainsKey(discovererPluginInformation.IdentifierData)); Assert.IsFalse(testExtensions.TestSettingsProviders.ContainsKey(discovererPluginInformation.IdentifierData)); }
public void GetTestExtensionsInformationShouldReturnDiscovererExtensions() { var pathToExtensions = new List <string> { typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location }; // The below should not throw an exception. var testExtensions = this.testPluginDiscoverer.GetTestExtensionsInformation <TestDiscovererPluginInformation, ITestDiscoverer>(pathToExtensions, loadOnlyWellKnownExtensions: true); var discovererPluginInformation = new TestDiscovererPluginInformation(typeof(ValidDiscoverer)); var discovererPluginInformation2 = new TestDiscovererPluginInformation(typeof(ValidDiscoverer2)); Assert.IsTrue(testExtensions.ContainsKey(discovererPluginInformation.IdentifierData)); Assert.IsTrue(testExtensions.ContainsKey(discovererPluginInformation2.IdentifierData)); }
public void MetadataShouldCreateMetadataFromMetadataType() { var testDiscovererPluginInfo = new TestDiscovererPluginInformation(typeof(DummyExtension)); LazyExtension <ITestDiscoverer, ITestDiscovererCapabilities> extension = new LazyExtension <ITestDiscoverer, ITestDiscovererCapabilities>( testDiscovererPluginInfo, typeof(DummyDiscovererCapability)); var metadata = extension.Metadata; Assert.IsNotNull(metadata); Assert.AreEqual(typeof(DummyDiscovererCapability), metadata.GetType()); CollectionAssert.AreEqual(new List <string> { "csv" }, (metadata as ITestDiscovererCapabilities).FileExtension.ToArray()); Assert.AreEqual("executor://unittestexecutor/", (metadata as ITestDiscovererCapabilities).DefaultExecutorUri.AbsoluteUri); }
public void AssemblyTypeShouldReturnNoneIfDiscovererHasUnknownCategory() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovereWithUnknownCategory)); Assert.AreEqual(AssemblyType.None, this.testPluginInformation.AssemblyType); }
public void AssemblyTypeShouldReturnManagedIfDiscovererHasManagedCategory() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovereWithManagedCategory)); Assert.AreEqual(AssemblyType.Managed, this.testPluginInformation.AssemblyType); }
public void AssemblyTypeShouldReturnNoneIfDiscovererHasCategoryWithEmptyValue() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovereWithCategoryHavingEmptyValue)); Assert.AreEqual(AssemblyType.None, this.testPluginInformation.AssemblyType); }
public void FileExtensionsShouldReturnEmptyListIfADiscovererSupportsNoFileExtensions() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovererWithNoFileExtensions)); Assert.IsNotNull(this.testPluginInformation.FileExtensions); Assert.AreEqual(0, this.testPluginInformation.FileExtensions.Count); }
public void IdentifierDataShouldReturnTestExtensionTypesName() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovererWithNoFileExtensions)); Assert.AreEqual(typeof(DummyTestDiscovererWithNoFileExtensions).AssemblyQualifiedName, this.testPluginInformation.IdentifierData); }
public void DefaultExecutorUriShouldReturnDefaultExecutorUriOfADiscoverer() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovererWithOneFileExtensions)); Assert.AreEqual("csvexecutor", this.testPluginInformation.DefaultExecutorUri); }
public void DefaultExecutorUriShouldReturnEmptyListIfADiscovererDoesNotHaveOne() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovererWithNoFileExtensions)); Assert.IsNotNull(this.testPluginInformation.DefaultExecutorUri); Assert.AreEqual(string.Empty, this.testPluginInformation.DefaultExecutorUri); }
public void AssemblyTypeShouldReturnAssemblyTypeIfDiscovererHasCategoryInArbitCasing() { this.testPluginInformation = new TestDiscovererPluginInformation(typeof(DummyTestDiscovereWithArbitCasedCategory)); Assert.AreEqual(AssemblyType.Native, this.testPluginInformation.AssemblyType); }