Exemplo n.º 1
0
 public void Test02()
 {
     GroboTestMachineryTrace.Log("Test02()");
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("WithWrappersSuite"));
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         "WithX(p=1).SetUp()",
         "WithY(q=2).SetUp()",
         "WithZ(r=3).SetUp()",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.WrapperDependencies_Test.Test01",
         "AndU(s=11).SetUp()",
         "AndV(t=12).SetUp()",
         "SetUp()",
         "Test01()",
         "TearDown()",
         "AndV(t=12).TearDown()",
         "AndU(s=11).TearDown()",
         $"MethodWrapper.TearDown() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.WrapperDependencies_Test.Test01",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.WrapperDependencies_Test.Test02",
         "AndU(s=11).SetUp()",
         "AndV(t=12).SetUp()",
         "SetUp()",
         "Test02()",
     });     // NB! полагаемся на алфавитный порядок запуска тестов внутри одного класса
 }
Exemplo n.º 2
0
 public override void TearDown(string testName, IEditableGroboTestContext suiteContext, IEditableGroboTestContext methodContext)
 {
     GroboTestMachineryTrace.Log("AndB.TearDown()");
     if (exceptionInTearDown)
     {
         throw new InvalidOperationException("Error in AndB.TearDown()");
     }
 }
 public void Qoo(int p)
 {
     GroboTestMachineryTrace.Log($"ServiceDependingOnManyStrings.Qoo(" +
                                 $"a={(a == null ? "null" : string.Join(", ", a))}, " +
                                 $"b={(b == null ? "null" : string.Join(", ", b))}, " +
                                 $"c={(c == null ? "null" : string.Join(", ", c))}, " +
                                 $"d={(d == null ? "null" : string.Join(", ", d))}, " +
                                 $"p={p})");
 }
 public void Test()
 {
     GroboTestMachineryTrace.Log("Test()");
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         "TestFixtureSetUp()",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::{GroboTestContext.Current.TestName()}",
         "Test()",
     });
 }
Exemplo n.º 5
0
 public void Test01()
 {
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("SharedSuiteContext"));
     GroboTestMachineryTrace.Log("Test01()");
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.SharedSuiteContext_Test+Part01.Test01",
         "Part01_SetUp()",
         "Test01()",
     });
 }
Exemplo n.º 6
0
 public void Test()
 {
     GroboTestMachineryTrace.Log("Test()");
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("InheritanceHierarchyForSetUpMethod"));
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::{GroboTestContext.Current.TestName()}",
         "TestBase_SetUp()",
         "Test()",
     });
 }
Exemplo n.º 7
0
 public void Test01()
 {
     GroboTestMachineryTrace.Log("Test01()");
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("ZZZZ"));
     Assert.That(GroboTestMachineryTrace.TraceLines, Is.EquivalentTo(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         "WithA(p=0).SetUp()",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::{GroboTestContext.Current.TestName()}",
         "AndU(s=0).SetUp()",
         "Test01()",
     }));
 }
 public void Test01()
 {
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("DefaultSuite"));
     Assert.That(GroboTestContext.Current.TestName(), Is.EqualTo(GetType().FullName + ".Test01"));
     GroboTestMachineryTrace.Log("Test01()");
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::{GroboTestContext.Current.TestName()}",
         "SetUp()",
         "Test01()",
     });
 }
Exemplo n.º 9
0
        public void SetUp()
        {
            GroboTestMachineryTrace.Log($"SetUp() for {GroboTestContext.Current.SuiteName()}");
            var serviceFromContainer = GroboTestContext.Current.Container.Get <IServiceWithNoDependencies>();

            if (serviceWithNoDependencies == null)
            {
                serviceWithNoDependencies = serviceFromContainer;
            }
            else
            {
                Assert.That(serviceFromContainer, Is.SameAs(serviceWithNoDependencies));
            }
        }
Exemplo n.º 10
0
        public async Task Test01()
        {
            await Task.Delay(1000);

            Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo(GetType().FullName));
            Assert.That(GroboTestContext.Current.TestName(), Is.EqualTo(GetType().FullName + ".Test01"));
            GroboTestMachineryTrace.Log("Test01()");
            AssertTestMachineryTrace(new[]
            {
                $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
                "TestFixtureSetUp()",
                $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::{GroboTestContext.Current.TestName()}",
                "SetUp()",
                "Test01()",
            });
        }
 public void Test02()
 {
     GroboTestMachineryTrace.Log("Test02()");
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         "TestFixtureSetUp()",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.GroboTestFixture_Test.Test01",
         "SetUp()",
         "Test01()",
         "TearDown()",
         $"MethodWrapper.TearDown() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.GroboTestFixture_Test.Test01",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.GroboTestFixture_Test.Test02",
         "SetUp()",
         "Test02()",
     });     // NB! полагаемся на алфавитный порядок запуска тестов внутри одного класса
 }
Exemplo n.º 12
0
 public void Test02()
 {
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("SharedSuiteContext"));
     GroboTestMachineryTrace.Log("Test02()");
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.SharedSuiteContext_Test+Part01.Test01",
         "Part01_SetUp()",
         "Test01()",
         "Part01_TearDown()",
         $"MethodWrapper.TearDown() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.SharedSuiteContext_Test+Part01.Test01",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.SharedSuiteContext_Test+Part02.Test02",
         "Part02_SetUp()",
         "Test02()",
     });     // NB! полагаемся на алфавитный порядок запуска тестов внутри одного класса
 }
Exemplo n.º 13
0
 public void Test01()
 {
     GroboTestMachineryTrace.Log("Test01()");
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("WithWrappersSuite"));
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         "WithX(p=1).SetUp()",
         "WithY(q=2).SetUp()",
         "WithZ(r=3).SetUp()",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::{GroboTestContext.Current.TestName()}",
         "AndU(s=11).SetUp()",
         "AndV(t=12).SetUp()",
         "SetUp()",
         "Test01()",
     });
 }
 public void TestX()
 {
     GroboTestMachineryTrace.Log("TestX()");
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("InheritanceHierarchy"));
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.DerivedTestClass_Test.Test01",
         "SetUp()",
         "Test01()",
         "TearDown()",
         $"MethodWrapper.TearDown() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.DerivedTestClass_Test.Test01",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.DerivedTestClass_Test.TestX",
         "SetUp()",
         "TestX()",
     });     // NB! полагаемся на алфавитный порядок запуска тестов внутри одного класса
 }
 public void Test02()
 {
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("DefaultSuite"));
     Assert.That(GroboTestContext.Current.TestName(), Is.EqualTo(GetType().FullName + ".Test02"));
     GroboTestMachineryTrace.Log("Test02()");
     AssertTestMachineryTrace(new[]
     {
         $"SuiteWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.Default_GroboTestSuite_Test.Test01",
         "SetUp()",
         "Test01()",
         "TearDown()",
         $"MethodWrapper.TearDown() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.Default_GroboTestSuite_Test.Test01",
         $"MethodWrapper.SetUp() for {GroboTestContext.Current.SuiteName()}::GroboContainer.NUnitExtensions.Tests.ExecutionOrder.Default_GroboTestSuite_Test.Test02",
         "SetUp()",
         "Test02()",
     });     // NB! полагаемся на алфавитный порядок запуска тестов внутри одного класса
 }
Exemplo n.º 16
0
 public void Test()
 {
     GroboTestMachineryTrace.Log("FailureInFieldInjection_ExplicitTest.Test()");
 }
Exemplo n.º 17
0
 public override void SetUp(string suiteName, Assembly testAssembly, IEditableGroboTestContext suiteContext)
 {
     GroboTestMachineryTrace.Log($"WithServiceDependingOnString(p={p}).SetUp()", suiteContext);
     suiteContext.Container.Configurator.ForAbstraction <IServiceDependingOnString>().UseInstances(new ServiceDependingOnString(p));
 }
Exemplo n.º 18
0
 public override void TearDown(string suiteName, Assembly testAssembly, IEditableGroboTestContext suiteContext)
 {
     GroboTestMachineryTrace.Log($"WithY(q={q}).TearDown()", suiteContext);
 }
Exemplo n.º 19
0
 public void Test()
 {
     GroboTestMachineryTrace.Log($"{nameof(FailureInTestAndTearDown_ExplicitTest)}.Test()");
     throw new InvalidOperationException($"Error in {nameof(FailureInTestAndTearDown_ExplicitTest)}.Test()");
 }
Exemplo n.º 20
0
 public override void SetUp(string testName, IEditableGroboTestContext suiteContext, IEditableGroboTestContext methodContext)
 {
     GroboTestMachineryTrace.ClearTrace();
     GroboTestMachineryTrace.Log("AndC.SetUp()");
 }
 public void TestFixtureSetUp(IEditableGroboTestContext suiteContext)
 {
     GroboTestMachineryTrace.Log("TestFixtureSetUp()");
 }
Exemplo n.º 22
0
 public override void SetUp(string testName, IEditableGroboTestContext suiteContext, IEditableGroboTestContext methodContext)
 {
     GroboTestMachineryTrace.Log($"AndV(t={t}).SetUp()", methodContext);
 }
Exemplo n.º 23
0
 public override void SetUp(string suiteName, Assembly testAssembly, IEditableGroboTestContext suiteContext)
 {
     GroboTestMachineryTrace.Log($"WithX(p={p}).SetUp()", suiteContext);
 }
Exemplo n.º 24
0
 public override void TearDown(string testName, IEditableGroboTestContext suiteContext, IEditableGroboTestContext methodContext)
 {
     GroboTestMachineryTrace.Log($"AndU(s={s}).TearDown()", methodContext);
 }
 public void Hoo(int q)
 {
     GroboTestMachineryTrace.Log($"ServiceDependingOnString.Hoo(p={param}, q={q})");
 }
 public void TearDown()
 {
     GroboTestMachineryTrace.Log("TearDown()");
 }
 public void SetUp()
 {
     GroboTestMachineryTrace.Log("SetUp()");
 }
 public void TestBase_SetUp()
 {
     GroboTestMachineryTrace.Log("TestBase_SetUp()");
 }
 public void Test01()
 {
     GroboTestMachineryTrace.Log("Test01()");
     Assert.That(GroboTestContext.Current.SuiteName(), Is.EqualTo("InheritanceHierarchyForSetUpMethod"));
 }
 public void Foo(int p)
 {
     GroboTestMachineryTrace.Log($"ServiceWithNoDependencies.Foo(p={p})");
 }