コード例 #1
0
        public void GreaterOrEqual_ValuesAreDatesAsStrings_CompareToCurrentDate_Val3NotGreaterThanCurrentDate_ExpectFalse()
        {
            //Arrange
            GreaterOrEqualModelOfDatesAsStrings model = new GreaterOrEqualModelOfDatesAsStrings {
                Val3 = new DateTime(1990, 1, 1).ToShortDateString()
            };
            //Act
            bool isValid = model.PropertyIsValid("Val3");

            //Assert
            isValid.ShouldBeFalse();
        }
コード例 #2
0
        public void GreaterOrEqual_ValuesAreDatesAsStrings_CompareToCurrentDate_Val3GreaterThanCurrentDate_ExpectTrue()
        {
            //Arrange
            GreaterOrEqualModelOfDatesAsStrings model = new GreaterOrEqualModelOfDatesAsStrings {
                Val3 = DateTime.Now.AddDays(1).ToShortDateString()
            };
            //Act
            bool isValid = model.PropertyIsValid("Val3");

            //Assert
            isValid.ShouldBeTrue();
        }
コード例 #3
0
        public void GreaterOrEqual_ValuesAreDatesAsStrings_CompareToCurrentDate_Val3EqualCurrentDate_ExpectTrue()
        {
            //Arrange
            GreaterOrEqualModelOfDatesAsStrings model = new GreaterOrEqualModelOfDatesAsStrings {
                Val3 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).ToShortDateString()
            };
            //Act
            bool isValid = model.PropertyIsValid("Val1");

            //Assert
            isValid.ShouldBeTrue();
        }
コード例 #4
0
        public void GreaterOrEqual_ValuesAreDatesAsStrings_SpecificValue_Val1EqualSpecificValue_ExpectTrue()
        {
            //Arrange
            GreaterOrEqualModelOfDatesAsStrings model = new GreaterOrEqualModelOfDatesAsStrings {
                Val1 = new DateTime(2010, 12, 31).ToShortDateString()
            };
            //Act
            bool isValid = model.PropertyIsValid("Val1");

            //Assert
            isValid.ShouldBeTrue();
        }
コード例 #5
0
        public void GreaterOrEqual_ValuesAreDatesAsStrings_Val1GreaterOrEqualThanVal2_ExpectFalse()
        {
            //Arrange
            GreaterOrEqualModelOfDatesAsStrings model = new GreaterOrEqualModelOfDatesAsStrings {
                Val1 = DateTime.Now.ToShortDateString(), Val2 = DateTime.Now.AddDays(-1).ToShortDateString()
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeFalse();
        }
コード例 #6
0
        public void GreaterOrEqual_ValuesAreDatesAsStrings_Val1IsNullAndVal2IsNotNull_ExpectTrue()
        {
            //Arrange
            GreaterOrEqualModelOfDatesAsStrings model = new GreaterOrEqualModelOfDatesAsStrings {
                Val1 = null, Val2 = DateTime.Now.ToShortDateString()
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeTrue();
        }
コード例 #7
0
        public void GreaterOrEqual_ValuesAreDatesAsStrings_Val1AndVal2_BothNull_ExpectTrue()
        {
            //Arrange
            GreaterOrEqualModelOfDatesAsStrings model = new GreaterOrEqualModelOfDatesAsStrings {
                Val1 = null, Val2 = null
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeTrue();
        }
コード例 #8
0
        public void GreaterOrEqual_ValuesAreDatesAsStrings_Val2GreaterOrEqualsVal1_ExpectTrue()
        {
            //Arrange
            DateTime date = DateTime.Now.Date;
            GreaterOrEqualModelOfDatesAsStrings model = new GreaterOrEqualModelOfDatesAsStrings {
                Val1 = date.ToShortDateString(), Val2 = date.AddDays(1).ToShortDateString()
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeTrue();
        }