예제 #1
0
        public void GivenGetSingleParkingLot_WhenRequestingSingleParkingLot_ReturnRequestedParkingLot()
        {
            using (var context = new ParkSharkDbContext(CreateNewInMemoryDatabase()))
            {
                var city       = City.CreateCity(2050, "Antwerpen", "Belgium");
                var service    = new ParkingLotService(context);
                var parkingLot = ParkingLotBuilder.CreateNewParkingLot()
                                 .WithName("test")
                                 .WithAddress(Address.CreateAddress("Parkinglotstraat", "20a", city))
                                 .WithContactPerson(ContactPerson.CreateNewContactPerson("Bas", "Adriaans", Address.CreateAddress("Contactpersoonstraat", "30", city), "*****@*****.**", "000000", ""))
                                 .WithCapacity(20)
                                 .WithDivision(Guid.NewGuid())
                                 .WithPricePerHour(4.5m)
                                 .Build();
                context.Set <ParkingLot>().Add(parkingLot);
                var id = parkingLot.ParkingLotID;
                context.SaveChanges();

                var result = service.GetSingleParkingLot(id);

                Assert.IsType <ParkingLot>(result);
                Assert.Equal(id, result.ParkingLotID);
                Assert.Equal("test", result.Name);
            }
        }
예제 #2
0
        public void GivenGetSingleParkingLotUnHappyPath_WhenRequestingSingleParkingLot_ReturnNull()
        {
            using (var context = new ParkSharkDbContext(CreateNewInMemoryDatabase()))
            {
                var service = new ParkingLotService(context);

                var id = new Guid();

                var result = service.GetSingleParkingLot(id);

                Assert.Null(result);
            }
        }