public void GivenAllNeccesaryPropertiesFromParkinglots_WhenMakingNewParkinglotsObject_ThenNoErrorThrow() { //Given Parkinglot testParkinglot = new Parkinglot() { Name = "test", Capacity = 1, AvailablePlaces = 1, DivisionId = 2, PricePerHour = 3, ContactPersonId = 4, PlAddress = new Address { StreetName = "ljhg", StreetNumber = "kuh", PostalCode = "lkjh", CityName = "lkjh" }, BuildingTypeId = 5 }; //when testParkinglot.CheckValues(); //then Assert.Equal("test", testParkinglot.Name); }
public void GivenNotAllNeccesaryPropertiesFromParkinglots_WhenMakingNewParkinglotsObject_ThenErrorThrow() { //Given Parkinglot testParkinglot = new Parkinglot() { Name = "test", Capacity = 1, AvailablePlaces = 1, DivisionId = 2, ContactPersonId = 4, PlAddress = new Address(), BuildingTypeId = 5 }; //when Action action = () => testParkinglot.CheckValues(); //then var exception = Assert.Throws <EntityNotValidException>(action); Assert.Contains("is required", exception.Message); }