コード例 #1
0
        public void Given_PriceOrVatIsWrong_When_ComputeVatIsCalled_Then_ShouldThrowArgumentException()
        {
            //Arrange
            Product product = new Product(1, "Paine", "Se mananca", DateTime.Parse("1/1/2009"), DateTime.Parse("1/1/2015"), 100, -30);

            //Act
            Action action = () => product.ComputeVAT();

            //Assert
            action.Should().Throw <ArgumentException>();
        }
コード例 #2
0
        public void Given_PriceAndVatAreCorrect_When_ComputeVatIsCalled_Then_ShouldReturnExpectedResult()
        {
            //Arrange
            Product product        = new Product(1, "Paine", "Se mananca", DateTime.Parse("1/1/2009"), DateTime.Parse("1/1/2015"), 100, 20);
            int     expectedResult = 120;

            //Act
            int actualResult = product.ComputeVAT();

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }