public void BarDelete() { //Setup ManagerController mc = new ManagerController(); Manager manager = new Manager("TestName", "TestPhonenumber", "TestEmail", "TestUsername", null); Manager m = mc.CreateManager(manager, "TestPassword"); Country country = LocationDB.Instance.getCountryById(1); if (country is null) { Assert.Fail("Country is null"); } Zipcode zip = LocationDB.Instance.findZipById(1); Address a = new Address("TestVej", zip); zip.Country = country; a.Zipcode = zip; Bar bar = new Bar { Address = a, Email = "TestBarEmail", Name = "TestBarName", PhoneNumber = "TestBarP", Username = "******" }; Bar expected = controller.Create(bar, m.Id, "TestPassword"); //Act bool isSuccess = controller.Delete(expected.ID); //Assert 1 Bar notFound = controller.Find(expected.ID); Assert.IsNull(notFound); //Assert 2 Assert.AreEqual(isSuccess, true, "The method returns an unexpected value"); }
public bool Delete(int id) { return(barController.Delete(id)); }