Example #1
0
        public void BeCreatedEmpty()
        {
            var operationFactory = Substitute.For <IOperationFactory>();

            var test = new TestExample1(operationFactory);

            test.Should().NotBeNull();
            test.Result.Should().Be(Result.NotTested);
            operationFactory.Received(0).CreateOperation(Arg.Any <string>());
        }
Example #2
0
        public void ObtainTestExample1()
        {
            var operationFactory = Substitute.For <IOperationFactory>();

            var factory = new TestFactory(operationFactory);

            var expectedTest = new TestExample1(operationFactory);
            var actualTest   = factory.CreateTest("testexample1");

            actualTest.Should().BeEquivalentTo(expectedTest);
        }
Example #3
0
        public void ExecuteOperations(string name)
        {
            var operationFactory = Substitute.For <IOperationFactory>();
            var operation        = new OperationExample1();

            operationFactory.CreateOperation(name).Returns(operation);

            var test            = new TestExample1(operationFactory);
            var operationActual = test.AddOperation(name);

            operationFactory.Received(1).CreateOperation(name);
            operationActual.Should().Be(operation);
        }
Example #4
0
        public void AddATestByName(string testName)
        {
            var testFactory      = Substitute.For <ITestFactory>();
            var operationFactory = Substitute.For <IOperationFactory>();
            var test             = new TestExample1(operationFactory);

            testFactory.CreateTest(testName).Returns(test);

            var order = new Order(testFactory);

            var actualTest = order.AddTest(testName);

            actualTest.Should().Be(test);
            testFactory.Received(1).CreateTest(testName);
        }