示例#1
0
        public ReservationServiceTests()
        {
            service = new ReservationService();

            service.CreateCampsite(new Campsite()
            {
                Id = 1, Name = "Cozy Cabin"
            });
            service.CreateCampsite(new Campsite()
            {
                Id = 2, Name = "Tent"
            });
            service.CreateCampsite(new Campsite()
            {
                Id = 3, Name = "Shoe"
            });
            service.CreateCampsite(new Campsite()
            {
                Id = 4, Name = "Hovel"
            });

            service.CreateReservation(new Reservation()
            {
                StartDate = new DateTime(4.Days().Ticks), EndDate = new DateTime(5.Days().Ticks), CampsiteId = 1
            });
            service.CreateReservation(new Reservation()
            {
                StartDate = new DateTime(12.Days().Ticks), EndDate = new DateTime(15.Days().Ticks), CampsiteId = 2
            });
            service.CreateReservation(new Reservation()
            {
                StartDate = new DateTime(4.Days().Ticks), EndDate = new DateTime(5.Days().Ticks), CampsiteId = 3
            });
            service.CreateReservation(new Reservation()
            {
                StartDate = new DateTime(4.Days().Ticks), EndDate = new DateTime(5.Days().Ticks), CampsiteId = 4
            });
        }
示例#2
0
        public void CanCreateOnlyUniqueCampsites(int id, string name, bool canCreate)
        {
            // Setup
            var campsite = new Campsite()
            {
                Id   = id,
                Name = name,
            };

            // Test
            var success = service.CreateCampsite(campsite);

            // Assert
            Assert.Equal(success, canCreate);
        }