public void TestAddWithAssemblyAlreadyAddedDoesNotReAddAssemblyAndReturnsAlreadyAddedAssembly() { NUnitSuite suite = new NUnitSuite("suite-name"); Assembly assembly = typeof(TestFixtureStubOne).Assembly; List <Assembly> expectedAssemblies = new List <Assembly> { assembly }; ITest testInitial = suite.Add(assembly); Assert.IsNotNull(testInitial); Assert.AreEqual(RunState.Runnable, testInitial.RunState); Assert.AreEqual("XamarinNUnitRunner.Test.Stub.dll", testInitial.Name); Assert.IsTrue(suite.ContainsAssembly(assembly)); Assert.IsTrue(suite.GetTestAssemblyRunner(assembly).IsTestLoaded); CollectionAssert.AreEquivalent(expectedAssemblies, suite.TestAssemblies); ITest test = suite.Add(assembly); Assert.IsNotNull(test); Assert.AreSame(testInitial, test); Assert.AreEqual(RunState.Runnable, test.RunState); Assert.AreEqual("XamarinNUnitRunner.Test.Stub.dll", test.Name); Assert.IsTrue(suite.ContainsAssembly(assembly)); Assert.IsTrue(suite.GetTestAssemblyRunner(assembly).IsTestLoaded); CollectionAssert.AreEquivalent(expectedAssemblies, suite.TestAssemblies); }
public void TestAddWithAssemblyNotAlreadyAddedLoadsAndAddsAssemblyAndReturnsAddedTest( [Values] bool withSettings) { string workingDirectory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..")); string expectedDirectory = withSettings ? workingDirectory : Directory.GetCurrentDirectory(); Dictionary <string, object> settings = withSettings ? new Dictionary <string, object> { { FrameworkPackageSettings.WorkDirectory, workingDirectory } } : null; NUnitSuite suite = new NUnitSuite("suite-name"); Assembly assembly = typeof(TestFixtureStubOne).Assembly; List <Assembly> expectedAssemblies = new List <Assembly> { assembly }; ITest test = suite.Add(assembly, settings); Assert.IsNotNull(test); Assert.AreEqual(RunState.Runnable, test.RunState); Assert.AreEqual("XamarinNUnitRunner.Test.Stub.dll", test.Name); Assert.IsTrue(suite.ContainsAssembly(assembly)); Assert.IsTrue(suite.GetTestAssemblyRunner(assembly).IsTestLoaded); Assert.AreEqual(expectedDirectory, TestContext.CurrentContext.WorkDirectory); CollectionAssert.AreEquivalent(expectedAssemblies, suite.TestAssemblies); }
public void TestContainsAssemblyWithAssemblyNullReturnsFalse() { NUnitSuite suite = new NUnitSuite("suite-name"); suite.Add(typeof(TestFixtureStubOne).Assembly); bool contains = suite.ContainsAssembly(null); Assert.IsFalse(contains); }
public void TestContainsAssemblyWithAssemblyAddedReturnsTrue() { NUnitSuite suite = new NUnitSuite("suite-name"); Assembly assembly = typeof(TestFixtureStubOne).Assembly; suite.Add(assembly); bool contains = suite.ContainsAssembly(assembly); Assert.IsTrue(contains); }