public void Assure_webSerivce_can_save_and_retreive_holidays()
        {
            var guid = Guid.NewGuid();
            var holiday = new Holiday() { Date = new DateTime(2010, 10, 12), Description = guid.ToString() };

            client.Save(new Holiday[]{ holiday });
            var holidays = client.Get(new AllSpecification<Holiday>());
            holidays.Single(h => h.Description == guid.ToString()).ShouldNotBeNull();

        }
        public void Assure_holidays_can_be_Saved()
        {
            var norwegianConstitutionDay = new Holiday() {Date = new DateTime(2010, 05, 17), Description = "17. Mai"};
            dbRepo.Save(norwegianConstitutionDay);

            RecreateSessionFactory();
            var newDbRepo = new HolidayDatabaseRepository(sessionFactory);
            var holidays = newDbRepo.Get(new AllSpecification<Holiday>());

            holidays.First().Date.ShouldBe(norwegianConstitutionDay.Date);
            holidays.First().Description.ShouldBe(norwegianConstitutionDay.Description);
        }
        public void Assure_repository_can_save_multiple_holidays()
        {
            var norwegianConstitutionDay = new Holiday() { Date = new DateTime(2010, 05, 17), Description = "17. Mai" };
            var someOldDate = new Holiday() {Date = new DateTime(10, 10, 10), Description = "This is an old old date"};
            dbRepo.Save(norwegianConstitutionDay);
            dbRepo.Save(someOldDate);

            RecreateSessionFactory();
            var newDbRepo = new HolidayDatabaseRepository(sessionFactory);
            var holidays = newDbRepo.Get(new AllSpecification<Holiday>());

            holidays.Count().ShouldBe(2);

            holidays.First().Date.ShouldBe(norwegianConstitutionDay.Date);
            holidays.First().Description.ShouldBe(norwegianConstitutionDay.Description);

            holidays.ElementAt(1).Date.ShouldBe(someOldDate.Date);
            holidays.ElementAt(1).Description.ShouldBe(someOldDate.Description);
        }
        public void Assure_saving_list_replaces_data_in_repository()
        {
            var norwegianConstitutionDay = new Holiday() { Date = new DateTime(2010, 05, 17), Description = "17. Mai" };
            var someOldDate = new Holiday() { Date = new DateTime(10, 10, 10), Description = "This is an old old date" };

            var firstList = new List<Holiday>() { norwegianConstitutionDay };
            var secondList = new List<Holiday>() { someOldDate };

            dbRepo.Save(firstList);
            dbRepo.Save(secondList);

            RecreateSessionFactory();
            var newDbRepo = new HolidayDatabaseRepository(sessionFactory);
            var holidays = newDbRepo.Get(new AllSpecification<Holiday>());

            holidays.Count().ShouldBe(1);

            holidays.First().Date.ShouldBe(someOldDate.Date);
            holidays.First().Description.ShouldBe(someOldDate.Description);
        }
Ejemplo n.º 5
0
 public void Holiday_needs_a_description()
 {
     var holiday = new Holiday();
     PropertyTester.TestForExistence<Holiday>( h=> h.Description );
 }
Ejemplo n.º 6
0
 public void Holiday_needs_a_date()
 {
     var holiday = new Holiday();
     PropertyTester.TestForExistence<Holiday>( h=> h.Date );
 }