Ejemplo n.º 1
0
        public void NumberSumIsCorrect_DerivedFixture()
        {
            // Arrange
            MyClassFixture fixture = new MyClassFixture();

            fixture.AddManyTo(fixture.Things);

            int expectedSum =
                fixture.Things.Select(t => t.Number).Sum();
            MyClass sut = fixture.Create <MyClass>();
            // Act
            int result = sut.CalculateSumOfThings();

            // Assert
            Assert.Equal <int>(expectedSum, result);
        }
Ejemplo n.º 2
0
        public void NumberSumIsCorrect_DerivedFixture()
        {
            // Fixture setup
            MyClassFixture fixture = new MyClassFixture();

            fixture.AddManyTo(fixture.Things);

            int expectedSum =
                fixture.Things.Select(t => t.Number).Sum();
            MyClass sut = fixture.Create <MyClass>();
            // Exercise system
            int result = sut.CalculateSumOfThings();

            // Verify outcome
            Assert.Equal <int>(expectedSum, result);
            // Teardown
        }