public void RemoveHreppurTest() { var svc = new HreppurService(); var expectedCount = svc.GetAllHreppurs().Count; var hreppurToDelete = svc.AddHreppur(new HreppurDto {Name = "MyName"}); if (svc.GetAllHreppurs().Count == 0) Assert.Inconclusive("There are no hreppurs in the repository to delete"); svc.RemoveHreppur(hreppurToDelete.HreppurId); Assert.AreEqual(expectedCount, svc.GetAllHreppurs().Count); }
public void UpdateHreppurTest() { var svc = new HreppurService(); var hreppur = new HreppurDto { Name = "InitialName" }; var actualHreppur = svc.AddHreppur(hreppur); var hreppurId = actualHreppur.HreppurId; var countBeforeUpdate = svc.GetAllHreppurs().Count; actualHreppur.Name = "UpdatedName"; svc.UpdateHreppur(actualHreppur); var countAfterUpdate = svc.GetAllHreppurs().Count; Assert.AreEqual(countBeforeUpdate, countAfterUpdate, "Updating a hreppur should not change the totalt count of hreppurs in the repository"); var updatedHreppur = svc.GetHreppurById(hreppurId); Assert.AreEqual("UpdatedName", updatedHreppur.Name); }