public Property GetProperty(char key) { Property property = null; if (properties.ContainsKey(key)) { property = properties[key]; } else { switch (key) { case 'I': { property = new ImmovableProperty(); break; } case 'M': { property = new MovableProperty(); break; } } properties.Add(key, property); } return(property); }
public IActionResult Edit(ImmovableProperty immovableProperty) { if (ModelState.IsValid) { _immovablePropertyRepository.EditImmovableProperty(immovableProperty); return(RedirectToAction("Index")); } return(View(immovableProperty)); }
public void GetProperty_IsNull() { // Arrange var propertyFactory = new ImmovablePropertyFactory(); var property = new ImmovableProperty() { Description = " budowlana o pow. 20 arów" }; // Act var newProperty = propertyFactory.GetProperty(property); // Assert Assert.IsNull(newProperty); }
public void GetProperty_IsBuildingPlot() { // Arrange var propertyFactory = new ImmovablePropertyFactory(); var property = new ImmovableProperty { Description = "Dzia³ka budowlana o pow. 20 arów" }; // Act var newProperty = propertyFactory.GetProperty(property); // Assert Assert.IsInstanceOfType(newProperty, typeof(BuildingPlot)); }
public void GetProperty_IsCommercialSpace() { // Arrange var propertyFactory = new ImmovablePropertyFactory(); var property = new ImmovableProperty { Description = "Lokal biurowy o pow. 100 mkw" }; // Act var newProperty = propertyFactory.GetProperty(property); // Assert Assert.IsInstanceOfType(newProperty, typeof(CommercialSpace)); }
public void GetProperty_IsHouse() { // Arrange var propertyFactory = new ImmovablePropertyFactory(); var property = new ImmovableProperty { Description = "Dom o pow. 120 mkw" }; // Act var newProperty = propertyFactory.GetProperty(property); // Assert Assert.IsInstanceOfType(newProperty, typeof(House)); }
public void GetProperty_IsFlat() { // Arrange var propertyFactory = new ImmovablePropertyFactory(); var property = new ImmovableProperty { Description = "Mieszkanie o pow. 50 mkw" }; // Act var newProperty = propertyFactory.GetProperty(property); // Assert Assert.IsInstanceOfType(newProperty, typeof(Flat)); }