public void Update_WhenNameNull_ShouldThrow() { using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new PartnersController(dataLayer)) controller.Update(new PartnerUpdate { Id = 1, Name = null, Address = null }); }
public void Update_WhenRecordDoesNotExist_ShouldThrow() { using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new PartnersController(dataLayer)) { var partnerUpdate = new PartnerUpdate { Id = 1, Name = "Nowhere Man", Address = "Nowhere Land" }; controller.Update(partnerUpdate); } }
public void Update_Normally_ShouldWork() { Partner createdPartner, updatedPartner; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new PartnersController(dataLayer)) { createdPartner = controller.CreatePartner(TestDataProvider.CreateNewPartner()); controller.Update(new PartnerUpdate { Id = createdPartner.Id, Name = "Eleanor Rigby", Address = "Liverpool" }); updatedPartner = controller.Get(createdPartner.Id); } Assert.AreEqual("Eleanor Rigby", updatedPartner.Name); Assert.AreEqual("Liverpool", updatedPartner.Address); }