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 SimpeHydrate_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); Assert.IsNotNull(id); Assert.AreEqual(id, pollingCentre.Id); }
public void SimpeDeHydrateAll_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); var owner = pollingCentreRepository.GetAll(); Assert.That(owner.Any()); }