Ejemplo n.º 1
0
 public void NotEqual_ValuesAreDates_Val1DoesNotEqualVal2_ExpectTrue()
 {
     //Arrange
     NotEqualModelOfDates model = new NotEqualModelOfDates {Val1 = DateTime.Now, Val2 = DateTime.Now.AddDays(1)};
     //Act
     bool isValid = model.PropertyIsValid("Val2");
     //Assert
     isValid.ShouldBeTrue();
 }
Ejemplo n.º 2
0
 public void NotEqual_ValuesAreDates_Val1IsNullAndVal2IsNotNull_ExpectTrue()
 {
     //Arrange
     NotEqualModelOfDates model = new NotEqualModelOfDates {Val1 = null, Val2 = DateTime.Now};
     //Act
     bool isValid = model.PropertyIsValid("Val2");
     //Assert
     isValid.ShouldBeTrue();
 }
Ejemplo n.º 3
0
 public void NotEqual_ValuesAreDates_SpecificValue_Val1NotEqualSpecificValue_ExpectFalse()
 {
     //Arrange
     NotEqualModelOfDates model = new NotEqualModelOfDates {Val1 = new DateTime(2010, 12, 31)};
     //Act
     bool isValid = model.PropertyIsValid("Val1");
     //Assert
     isValid.ShouldBeFalse();
 }
Ejemplo n.º 4
0
 public void NotEqual_ValuesAreDates_SpecificValue_Val3DoesNotEquaCurrentDate_ExpectTrue()
 {
     //Arrange
     NotEqualModelOfDates model = new NotEqualModelOfDates {Val1 = DateTime.Now.AddDays(-1)};
     //Act
     bool isValid = model.PropertyIsValid("Val3");
     //Assert
     isValid.ShouldBeTrue();
 }
Ejemplo n.º 5
0
 public void NotEqual_ValuesAreDates_CurrentDate_Val3NotEqualCurrentDate_ExpectFalse()
 {
     //Arrange
     NotEqualModelOfDates model = new NotEqualModelOfDates {Val3 = DateTime.Now.Date};
     //Act
     bool isValid = model.PropertyIsValid("Val3");
     //Assert
     isValid.ShouldBeFalse();
 }
Ejemplo n.º 6
0
        public void NotEqual_ValuesAreDates_SpecificValue_Val3DoesNotEquaCurrentDate_ExpectTrue()
        {
            //Arrange
            NotEqualModelOfDates model = new NotEqualModelOfDates {
                Val1 = DateTime.Now.AddDays(-1)
            };
            //Act
            bool isValid = model.PropertyIsValid("Val3");

            //Assert
            isValid.ShouldBeTrue();
        }
Ejemplo n.º 7
0
        public void NotEqual_ValuesAreDates_CurrentDate_Val3NotEqualCurrentDate_ExpectFalse()
        {
            //Arrange
            NotEqualModelOfDates model = new NotEqualModelOfDates {
                Val3 = DateTime.Now.Date
            };
            //Act
            bool isValid = model.PropertyIsValid("Val3");

            //Assert
            isValid.ShouldBeFalse();
        }
Ejemplo n.º 8
0
        public void NotEqual_ValuesAreDates_SpecificValue_Val1NotEqualSpecificValue_ExpectFalse()
        {
            //Arrange
            NotEqualModelOfDates model = new NotEqualModelOfDates {
                Val1 = new DateTime(2010, 12, 31)
            };
            //Act
            bool isValid = model.PropertyIsValid("Val1");

            //Assert
            isValid.ShouldBeFalse();
        }
Ejemplo n.º 9
0
        public void NotEqual_ValuesAreDates_Val1DoesNotEqualVal2_ExpectTrue()
        {
            //Arrange
            NotEqualModelOfDates model = new NotEqualModelOfDates {
                Val1 = DateTime.Now, Val2 = DateTime.Now.AddDays(1)
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeTrue();
        }
Ejemplo n.º 10
0
        public void NotEqual_ValuesAreDates_Val1IsNullAndVal2IsNotNull_ExpectTrue()
        {
            //Arrange
            NotEqualModelOfDates model = new NotEqualModelOfDates {
                Val1 = null, Val2 = DateTime.Now
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeTrue();
        }
Ejemplo n.º 11
0
        public void NotEqual_ValuesAreDates_Val1NotEqualVal2_ExpectFalse()
        {
            //Arrange
            DateTime             date  = DateTime.Now.Date;
            NotEqualModelOfDates model = new NotEqualModelOfDates {
                Val1 = date, Val2 = date
            };
            //Act
            bool isValid = model.PropertyIsValid("Val2");

            //Assert
            isValid.ShouldBeFalse();
        }
Ejemplo n.º 12
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)
            };
        }
Ejemplo n.º 13
0
 public void NotEqual_ValuesAreDates_Val1NotEqualVal2_ExpectFalse()
 {
     //Arrange
     DateTime date = DateTime.Now.Date;
     NotEqualModelOfDates model = new NotEqualModelOfDates {Val1 = date, Val2 = date};
     //Act
     bool isValid = model.PropertyIsValid("Val2");
     //Assert
     isValid.ShouldBeFalse();
 }