예제 #1
0
        public void LessOrEqual_ValuesAreLongs_SpecificValue_Val1LessThanSpecificValue_ExpectTrue()
        {
            //Arrange
            LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {
                Val1 = 0
            };
            //Act
            bool isValid = model.PropertyIsValid("Val1");

            //Assert
            isValid.ShouldBeTrue();
        }
예제 #2
0
        public void LessOrEqual_ValuesAreLongs_Val1LessOrEqualThanVal2_ExpectFalse()
        {
            //Arrange
            LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {
                Val1 = 1, Val2 = 2
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeFalse();
        }
예제 #3
0
        public void LessOrEqual_ValuesAreLongs_Val2EqualsVal1_ExpectTrue()
        {
            //Arrange
            LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {
                Val1 = 1, Val2 = 1
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeTrue();
        }
예제 #4
0
        public void LessOrEqual_ValuesAreLongs_Val1IsNullAndVal2IsNotNull_ExpectFalse()
        {
            //Arrange
            LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {
                Val1 = null, Val2 = 1
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeFalse();
        }
예제 #5
0
        public void LessOrEqual_ValuesAreLongs_Val1AndVal2_BothNull_ExpectTrue()
        {
            //Arrange
            LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {
                Val1 = null, Val2 = null
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeTrue();
        }
예제 #6
0
        public ValidationViewModel()
        {
            EqualModelOfStrings_Valid = new EqualModelOfStrings {
                Val1 = "Hello World", Val2 = "Hello World", Val3 = DateTime.Now.ToShortDateString(), Val4 = DateTime.Now.AddDays(-1).ToShortDateString(), Val5 = DateTime.Now.AddDays(1).ToShortDateString()
            };
            EqualModelOfStrings_Invalid = new EqualModelOfStrings {
                Val1 = "Not Hello World", Val2 = "Hello World", Val3 = DateTime.Now.AddDays(-1).ToShortDateString(), Val4 = DateTime.Now.AddDays(-10).ToShortDateString(), Val5 = DateTime.Now.AddDays(10).ToShortDateString()
            };
            EqualModelOfLongs_Valid = new EqualModelOfLongs {
                Val1 = 99, Val2 = 99, Val3 = null, Val4 = null
            };
            EqualModelOfLongs_Invalid = new EqualModelOfLongs {
                Val1 = 100, Val2 = 101, Val3 = null, Val4 = 1
            };
            EqualModelOfDates_Valid = new EqualModelOfDates {
                Val1 = new DateTime(2010, 12, 31), Val2 = new DateTime(2010, 12, 31), Val3 = DateTime.Now.Date, Val4 = null, Val5 = null, Val6 = DateTime.Now.AddDays(-1).Date, Val7 = DateTime.Now.AddDays(1).Date
            };
            EqualModelOfDates_Invalid = new EqualModelOfDates {
                Val1 = new DateTime(2009, 12, 31), Val2 = new DateTime(2000, 12, 31), Val3 = DateTime.Now.Date.AddDays(1), Val4 = null, Val5 = DateTime.Now.Date, Val6 = DateTime.Now.AddDays(-10).Date, Val7 = DateTime.Now.AddDays(10).Date
            };

            NotEqualModelOfStrings_Invalid = new NotEqualModelOfStrings {
                Val1 = "Hello World", Val2 = "Hello World", Val3 = DateTime.Now.ToShortDateString()
            };
            NotEqualModelOfStrings_Valid = new NotEqualModelOfStrings {
                Val1 = "Not Hello World", Val2 = "Hello World", Val3 = DateTime.Now.AddDays(-1).ToShortDateString()
            };
            NotEqualModelOfLongs_Invalid = new NotEqualModelOfLongs {
                Val1 = 99, Val2 = 99, Val3 = null, Val4 = null
            };
            NotEqualModelOfLongs_Valid = new NotEqualModelOfLongs {
                Val1 = 100, Val2 = 101, Val3 = null, Val4 = 1
            };
            NotEqualModelOfDates_Invalid = new NotEqualModelOfDates {
                Val1 = new DateTime(2010, 12, 31), Val2 = new DateTime(2010, 12, 31), Val3 = DateTime.Now.Date, Val4 = null, Val5 = null
            };
            NotEqualModelOfDates_Valid = new NotEqualModelOfDates {
                Val1 = new DateTime(2009, 12, 31), Val2 = new DateTime(2000, 12, 31), Val3 = DateTime.Now.Date.AddDays(1), Val4 = null, Val5 = DateTime.Now
            };

            GreaterModelOfDatesAsStrings_Valid = new GreaterModelOfDatesAsStrings {
                Val1 = new DateTime(2011, 12, 31).ToShortDateString(), Val2 = new DateTime(2012, 12, 31).ToShortDateString(), Val3 = DateTime.Now.Date.AddDays(1).ToShortDateString(), Val4 = DateTime.Now.Date.AddDays(1).ToShortDateString()
            };
            GreaterModelOfDatesAsStrings_Invalid = new GreaterModelOfDatesAsStrings {
                Val1 = new DateTime(2009, 12, 31).ToShortDateString(), Val2 = new DateTime(2000, 12, 31).ToShortDateString(), Val3 = DateTime.Now.Date.AddDays(-1).ToShortDateString(), Val4 = DateTime.Now.Date.AddDays(-1).ToShortDateString()
            };
            GreaterModelOfLongs_Valid = new GreaterModelOfLongs {
                Val1 = 99, Val2 = 100
            };
            GreaterModelOfLongs_Invalid = new GreaterModelOfLongs {
                Val1 = -100, Val2 = -200, Val3 = -200
            };
            GreaterModelOfDates_Valid = new GreaterModelOfDates {
                Val1 = new DateTime(2011, 12, 31), Val2 = new DateTime(2012, 12, 31), Val3 = DateTime.Now.Date.AddDays(1)
            };
            GreaterModelOfDates_Invalid = new GreaterModelOfDates {
                Val1 = new DateTime(2009, 12, 31), Val2 = new DateTime(2000, 12, 31), Val3 = DateTime.Now.Date.AddDays(-1), Val4 = DateTime.Now.Date.AddDays(-1)
            };

            LessModelOfDatesAsStrings_Invalid = new LessModelOfDatesAsStrings {
                Val1 = new DateTime(2011, 12, 31).ToShortDateString(), Val2 = new DateTime(2012, 12, 31).ToShortDateString(), Val3 = DateTime.Now.Date.AddDays(1).ToShortDateString(), Val4 = DateTime.Now.Date.AddDays(1).ToShortDateString()
            };
            LessModelOfDatesAsStrings_Valid = new LessModelOfDatesAsStrings {
                Val1 = new DateTime(2009, 12, 31).ToShortDateString(), Val2 = new DateTime(2000, 12, 31).ToShortDateString(), Val3 = DateTime.Now.Date.AddDays(-1).ToShortDateString()
            };
            LessModelOfLongs_Invalid = new LessModelOfLongs {
                Val1 = 99, Val2 = 100, Val3 = 100
            };
            LessModelOfLongs_Valid = new LessModelOfLongs {
                Val1 = -100, Val2 = -200
            };
            LessModelOfDates_Invalid = new LessModelOfDates {
                Val1 = new DateTime(2011, 12, 31), Val2 = new DateTime(2012, 12, 31), Val3 = DateTime.Now.Date.AddDays(1), Val4 = DateTime.Now.Date.AddDays(1)
            };
            LessModelOfDates_Valid = new LessModelOfDates {
                Val1 = new DateTime(2009, 12, 31), Val2 = new DateTime(2000, 12, 31), Val3 = DateTime.Now.Date.AddDays(-1), Val4 = DateTime.Now.Date.AddDays(-1)
            };

            GreaterOrEqualModelOfDatesAsStrings_Valid = new GreaterOrEqualModelOfDatesAsStrings {
                Val1 = new DateTime(2011, 12, 31).ToShortDateString(), Val2 = new DateTime(2012, 12, 31).ToShortDateString(), Val3 = DateTime.Now.Date.AddDays(1).ToShortDateString(), Val4 = DateTime.Now.Date.AddDays(1).ToShortDateString()
            };
            GreaterOrEqualModelOfDatesAsStrings_Invalid = new GreaterOrEqualModelOfDatesAsStrings {
                Val1 = new DateTime(2009, 12, 31).ToShortDateString(), Val2 = new DateTime(2000, 12, 31).ToShortDateString(), Val3 = DateTime.Now.Date.AddDays(-1).ToShortDateString()
            };
            GreaterOrEqualModelOfLongs_Valid = new GreaterOrEqualModelOfLongs {
                Val1 = 99, Val2 = 100, Val3 = 100
            };
            GreaterOrEqualModelOfLongs_Invalid = new GreaterOrEqualModelOfLongs {
                Val1 = -100, Val2 = -200
            };
            GreaterOrEqualModelOfDates_Valid = new GreaterOrEqualModelOfDates {
                Val1 = new DateTime(2011, 12, 31), Val2 = new DateTime(2012, 12, 31), Val3 = DateTime.Now.Date.AddDays(1), Val4 = DateTime.Now.Date.AddDays(1)
            };
            GreaterOrEqualModelOfDates_Invalid = new GreaterOrEqualModelOfDates {
                Val1 = new DateTime(2009, 12, 31), Val2 = new DateTime(2000, 12, 31), Val3 = DateTime.Now.Date.AddDays(-1)
            };

            LessOrEqualModelOfDatesAsStrings_Invalid = new LessOrEqualModelOfDatesAsStrings {
                Val1 = new DateTime(2011, 12, 31).ToShortDateString(), Val2 = new DateTime(2012, 12, 31).ToShortDateString(), Val3 = DateTime.Now.Date.AddDays(1).ToShortDateString(), Val4 = DateTime.Now.Date.AddDays(1).ToShortDateString()
            };
            LessOrEqualModelOfDatesAsStrings_Valid = new LessOrEqualModelOfDatesAsStrings {
                Val1 = new DateTime(2009, 12, 31).ToShortDateString(), Val2 = new DateTime(2000, 12, 31).ToShortDateString(), Val3 = DateTime.Now.Date.AddDays(-1).ToShortDateString()
            };
            LessOrEqualModelOfLongs_Invalid = new LessOrEqualModelOfLongs {
                Val1 = 99, Val2 = 100
            };
            LessOrEqualModelOfLongs_Valid = new LessOrEqualModelOfLongs {
                Val1 = -100, Val2 = -200, Val3 = -200
            };
            LessOrEqualModelOfDates_Invalid = new LessOrEqualModelOfDates {
                Val1 = new DateTime(2011, 12, 31), Val2 = new DateTime(2012, 12, 31), Val3 = DateTime.Now.Date.AddDays(1)
            };
            LessOrEqualModelOfDates_Valid = new LessOrEqualModelOfDates {
                Val1 = new DateTime(2009, 12, 31), Val2 = new DateTime(2000, 12, 31), Val3 = DateTime.Now.Date.AddDays(-1), Val4 = DateTime.Now.Date.AddDays(-1)
            };
        }
예제 #7
0
 public void LessOrEqual_ValuesAreLongs_Val2LessOrEqualThanVal1_ExpectTrue()
 {
     //Arrange
     LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {Val1 = 2, Val2 = 1};
     //Act
     bool isValid = model.PropertyIsValid("Val2");
     //Assert
     isValid.ShouldBeTrue();
 }
예제 #8
0
 public void LessOrEqual_ValuesAreLongs_Val1IsNullAndVal2IsNotNull_ExpectFalse()
 {
     //Arrange
     LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {Val1 = null, Val2 = 1};
     //Act
     bool isValid = model.PropertyIsValid("Val2");
     //Assert
     isValid.ShouldBeFalse();
 }
예제 #9
0
 public void LessOrEqual_ValuesAreLongs_Val1AndVal2_BothNull_ExpectTrue()
 {
     //Arrange
     LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {Val1 = null, Val2 = null};
     //Act
     bool isValid = model.PropertyIsValid("Val2");
     //Assert
     isValid.ShouldBeTrue();
 }
예제 #10
0
 public void LessOrEqual_ValuesAreLongs_SpecificValue_Val1NotLessThanSpecificValue_ExpectFalse()
 {
     //Arrange
     LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {Val1 = 2};
     //Act
     bool isValid = model.PropertyIsValid("Val1");
     //Assert
     isValid.ShouldBeFalse();
 }
예제 #11
0
 public void LessOrEqual_ValuesAreLongs_SpecificValue_Val1EqualSpecificValue_ExpectTrue()
 {
     //Arrange
     LessOrEqualModelOfLongs model = new LessOrEqualModelOfLongs {Val1 = 1};
     //Act
     bool isValid = model.PropertyIsValid("Val1");
     //Assert
     isValid.ShouldBeTrue();
 }