示例#1
0
        public void BuildShouldCreatePaymentIfEveryPropertyIsSet()
        {
            // Arrange
            var paymentFactory = new PaymentFactory();

            // Act
            Action act = () => paymentFactory
                         .WithTitle("Payment for september")
                         .WithAmount(4.56m)
                         .WithPaymentDue(new DateTimeRange(DateTime.Now, DateTime.Now.AddDays(5)))
                         .WithStudent(1)
                         .Build();

            // Assert
            paymentFactory.Should().NotBeNull();
        }
示例#2
0
        public void BuildShouldThrowExceptionIfDateTimeRangeNotValid()
        {
            // Arrange
            var paymentFactory = new PaymentFactory();

            // Act
            Action act = () => paymentFactory
                         .WithTitle("Payment for september")
                         .WithPaymentDue(new DateTimeRange(DateTime.Now, DateTime.Now.AddDays(-5)))
                         .WithAmount(4.56m)
                         .WithStudent(1)
                         .Build();

            // Assert
            act.Should().Throw <InvalidDateRangeException>();
        }