예제 #1
0
        public void Constructor_SetsCorrectDateValues()
        {
            var dateTimeProviderMock = new DateTimeProviderMock
            {
                NowValue = DateTime.Parse("01/01/2001")
            };
            var coupon = new Coupon(dateTimeProviderMock);

            Assert.Equal(DateTime.Parse("01/01/2001"), coupon.CreationDate);
            Assert.Equal(DateTime.Parse("01/15/2001"), coupon.ExpirationDate);
        }
예제 #2
0
        public void IsExpired_ReturnsCorrectValue()
        {
            var dateTimeProviderMock = new DateTimeProviderMock
            {
                NowValue = DateTime.Parse("01/01/2001")
            };
            var coupon = new Coupon(dateTimeProviderMock);

            Assert.False(coupon.IsExpired);
            dateTimeProviderMock.NowValue = DateTime.Parse("01/14/2001");
            Assert.False(coupon.IsExpired);
            dateTimeProviderMock.NowValue = DateTime.Parse("01/15/2001");
            Assert.True(coupon.IsExpired);
        }