Exemplo n.º 1
0
        public void Simple_Status_Ward()
        {
            IConstituencyRepository constituencyRepository = Substitute.For <IConstituencyRepository>();
            var f            = new Fixture();
            var constituency = f.Create <Constituency>();
            var ward         = CreateWard(constituency.GetMasterDataRef());

            constituencyRepository.GetById(Arg.Any <Guid>()).Returns(constituency);
            var wardRepository = new WardRepository(ContextConnection(), constituencyRepository);

            wardRepository.Save(ward);
            wardRepository.SetInactive(ward);
            var inactive = wardRepository.GetById(ward.Id);

            Assert.That(inactive.Status == EntityStatus.Inactive);

            wardRepository.SetActive(ward);
            var active = wardRepository.GetById(ward.Id);

            Assert.That(active.Status == EntityStatus.Active);

            wardRepository.SetAsDeleted(ward);
            var deleted = wardRepository.GetById(ward.Id);

            Assert.That(deleted.Status == EntityStatus.Deleted);
        }
Exemplo n.º 2
0
        public void SimpeHydrate_Ward()
        {
            IConstituencyRepository constituencyRepository = Substitute.For <IConstituencyRepository>();
            var f            = new Fixture();
            var constituency = f.Create <Constituency>();
            var ward         = CreateWard(constituency.GetMasterDataRef());

            constituencyRepository.GetById(Arg.Any <Guid>()).Returns(constituency);
            var wardRepository = new WardRepository(ContextConnection(), constituencyRepository);
            var id             = wardRepository.Save(ward);

            Assert.IsNotNull(id);
            Assert.AreEqual(id, ward.Id);
        }
Exemplo n.º 3
0
        public void SimpeDeHydrateAll_Ward()
        {
            IConstituencyRepository constituencyRepository = Substitute.For <IConstituencyRepository>();
            var f            = new Fixture();
            var constituency = f.Create <Constituency>();
            var ward         = CreateWard(constituency.GetMasterDataRef());

            constituencyRepository.GetById(Arg.Any <Guid>()).Returns(constituency);
            var wardRepository = new WardRepository(ContextConnection(), constituencyRepository);

            wardRepository.Save(ward);
            var owner = wardRepository.GetAll();

            Assert.That(owner.Any());
        }