コード例 #1
0
        public void GivenFromParkingLotCreateToParkingLotWithoutBuildingType_WhenLeavingBuildingTypeEmpty_ThenBuildingTypeisDefaultAboveGround()
        {
            var memstub = Substitute.For <IMemberServices>();
            ParkingLotMapper parkmap = new ParkingLotMapper(new AddressMapper(new CityMapper(memstub)), new ContactPersonMapper(new AddressMapper(new CityMapper(memstub))));
            var cityDTO = new CityDTO {
                ZIP = 2050, CityName = "Antwerpen", CountryName = "Belgium"
            };
            var addres = new AddressDTO {
                StreetName = "teststreet", StreetNumber = "58", CityDTO = cityDTO
            };
            var contactPerson = new ContactPersonDTO {
                FirstName = "lars", Address = addres, Email = "*****@*****.**", LastName = "peelman", MobilePhoneNumber = "55555", PhoneNumber = "55555"
            };
            var parkinglotDTO = new ParkingLotDTO_Create {
                Address = addres, Capacity = 5, ContactPerson = contactPerson, DivisionID = new Guid(), Name = "lasr", PricePerHour = 5.00M
            };

            var result = parkmap.FromParkingLotCreateToParkingLot(parkinglotDTO);

            Assert.Equal("AboveGround", result.BuildingType.ToString());
        }
コード例 #2
0
        public void GivenCreateParkingLotFromParkingLotDTO_WhenGivenParkinglotToCreate_ThenCreateParkingLot()
        {
            var memstub              = Substitute.For <IMemberServices>();
            var stubpark             = Substitute.For <IParkingLotMapper>();
            ParkingLotMapper parkmap = new ParkingLotMapper(new AddressMapper(new CityMapper(memstub)), new ContactPersonMapper(new AddressMapper(new CityMapper(memstub))));
            var cityDTO              = new CityDTO {
                ZIP = 2050, CityName = "Antwerpen", CountryName = "Belgium"
            };

            var addres = new AddressDTO {
                StreetName = "teststreet", StreetNumber = "58", CityDTO = cityDTO
            };
            var contactPerson = new ContactPersonDTO {
                FirstName = "lars", Address = addres, Email = "*****@*****.**", LastName = "peelman", MobilePhoneNumber = "55555", PhoneNumber = "55555"
            };

            var parkinglotDTO = new ParkingLotDTO_Create {
                Address = addres, Buildingtype = BuildingType.AboveGround.ToString(), Capacity = 5, ContactPerson = contactPerson, DivisionID = new Guid(), Name = "lasr", PricePerHour = 5.00M
            };
            var result = parkmap.FromParkingLotCreateToParkingLot(parkinglotDTO);

            Assert.IsType <ParkingLot>(result);
        }