Пример #1
0
        public void GetPersonsBetweenDates_TwoDatesGiven_SecondDateSmallerThenFirst_ThrowsException()
        {
            var bDate1 = RandomUtil.GetRandomDateInThePast(1);
            var bDate2 = bDate1.AddDays(-1);

            Assert.Throws <Exception>(() => PersonQueries.GetPersonsBetweenBirthDates(Context, bDate1, bDate2));
        }
Пример #2
0
 private Person CreatePerson(string firstName = null, string lastName = null, DateTime?bDate = null)
 {
     return(PersonCommands.SavePerson(new Person
     {
         FirstName = firstName ?? RandomUtil.GetRandomString(),
         LastName = lastName ?? RandomUtil.GetRandomString(),
         BirthDate = bDate ?? RandomUtil.GetRandomDateInThePast(1)
     }, Context));
 }
Пример #3
0
 private static Person CreatePerson()
 {
     return(new Person
     {
         FirstName = RandomUtil.GetRandomString(),
         LastName = RandomUtil.GetRandomString(),
         BirthDate = RandomUtil.GetRandomDateInThePast(1)
     });
 }
Пример #4
0
        public void GetPersonsBetweenBirthDates_PersonBornOnThatDay_ReturnsThatPersonInTheList()
        {
            var bDate  = RandomUtil.GetRandomDateInThePast(1);
            var person = CreatePerson(RandomUtil.GetRandomString(), RandomUtil.GetRandomString(), bDate);

            var persons = PersonQueries.GetPersonsBetweenBirthDates(Context, bDate);

            Assert.IsNotEmpty(persons);
            Assert.IsTrue(persons.Contains(person));
        }
Пример #5
0
        public void GetPersonsBetweenBirthDates_TwoDatesGiven_ReturnsPersons()
        {
            var bDate1  = RandomUtil.GetRandomDateInThePast(1);
            var person1 = CreatePerson(RandomUtil.GetRandomString(), RandomUtil.GetRandomString(), bDate1);
            var bDate2  = RandomUtil.GetRandomDateInThePast(1);
            var person2 = CreatePerson(RandomUtil.GetRandomString(), RandomUtil.GetRandomString(), bDate2);

            SwitchDatesIfNeeded(ref bDate2, ref bDate1);

            var persons = PersonQueries.GetPersonsBetweenBirthDates(Context, bDate1, bDate2);

            Assert.IsNotEmpty(persons);
            Assert.IsTrue(persons.Contains(person1));
            Assert.IsTrue(persons.Contains(person2));
        }
Пример #6
0
 public void GetRandomDateInThePast_DateIsInThePast()
 {
     Assert.Less(RandomUtil.GetRandomDateInThePast(), DateTime.Now);
 }