public void Simple_Status_PollingCentre() { IWardRepository wardRepository = Substitute.For <IWardRepository>(); var f = new Fixture(); var ward = f.Create <Ward>(); var pollingCentre = Create(ward.GetMasterDataRef()); wardRepository.GetById(Arg.Any <Guid>()).Returns(ward); var pollingCentreRepository = new PollingCentreRepository(ContextConnection(), wardRepository); pollingCentreRepository.Save(pollingCentre); pollingCentreRepository.SetInactive(pollingCentre); var inactive = pollingCentreRepository.GetById(pollingCentre.Id); Assert.That(inactive.Status == EntityStatus.Inactive); pollingCentreRepository.SetActive(pollingCentre); var active = pollingCentreRepository.GetById(pollingCentre.Id); Assert.That(active.Status == EntityStatus.Active); pollingCentreRepository.SetAsDeleted(pollingCentre); var deleted = pollingCentreRepository.GetById(pollingCentre.Id); Assert.That(deleted.Status == EntityStatus.Deleted); }
public void SimpeDeHydrate_PollingCentre() { IWardRepository wardRepository = Substitute.For <IWardRepository>(); var f = new Fixture(); var ward = f.Create <Ward>(); var pollingCentre = Create(ward.GetMasterDataRef()); wardRepository.GetById(Arg.Any <Guid>()).Returns(ward); var pollingCentreRepository = new PollingCentreRepository(ContextConnection(), wardRepository); var id = pollingCentreRepository.Save(pollingCentre); var owner = pollingCentreRepository.GetById(id); Assert.IsNotNull(owner); Assert.AreEqual(owner.Id, pollingCentre.Id); }