public void Simple_Status_County()
        {
            IRegionRepository regionRepository = Substitute.For <IRegionRepository>();
            var f      = new Fixture();
            var region = f.Create <Region>();
            var county = CreateCounty(region.GetMasterDataRef());

            regionRepository.GetById(Arg.Any <Guid>()).Returns(region);
            var countyRepository = new CountyRepository(ContextConnection(), regionRepository);

            countyRepository.Save(county);
            countyRepository.SetInactive(county);
            var inactive = countyRepository.GetById(county.Id);

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

            countyRepository.SetActive(county);
            var active = countyRepository.GetById(county.Id);

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

            countyRepository.SetAsDeleted(county);
            var deleted = countyRepository.GetById(county.Id);

            Assert.That(deleted.Status == EntityStatus.Deleted);
        }
        public void SimpeHydrate_County()
        {
            IRegionRepository regionRepository = Substitute.For <IRegionRepository>();
            var f      = new Fixture();
            var region = f.Create <Region>();
            var county = CreateCounty(region.GetMasterDataRef());

            regionRepository.GetById(Arg.Any <Guid>()).Returns(region);
            var countyRepository = new CountyRepository(ContextConnection(), regionRepository);
            var id = countyRepository.Save(county);

            Assert.IsNotNull(id);
            Assert.AreEqual(id, county.Id);
        }
        public void SimpeDeHydrateAll_County()
        {
            IRegionRepository regionRepository = Substitute.For <IRegionRepository>();
            var f      = new Fixture();
            var region = f.Create <Region>();
            var county = CreateCounty(region.GetMasterDataRef());

            regionRepository.GetById(Arg.Any <Guid>()).Returns(region);
            var countyRepository = new CountyRepository(ContextConnection(), regionRepository);

            countyRepository.Save(county);
            var owner = countyRepository.GetAll();

            Assert.That(owner.Any());
        }
Exemplo n.º 4
0
        // [TAG]Save Related Data
        static void AddSimpleCounty()
        {
            var city = new City
            {
                CityCode     = 9,
                FullName     = "Hà Giang",
                IsDelete     = false,
                NameFormated = "Hà_Giang_9",
            };

            var county = new County()
            {
                City         = city,
                FullName     = "County_1" + city.FullName,
                NameFormated = "County_1" + city.NameFormated,
                IsDelete     = false,
            };

            var countyRepo = new CountyRepository();

            countyRepo.Add(new List <County> {
                county
            });
        }
Exemplo n.º 5
0
 public static List <County> GetAllCounties()
 {
     return(CountyRepository.GetAllCounties());
 }
Exemplo n.º 6
0
        static void InitialCountyData()
        {
            var countyRepository = new CountyRepository();

            countyRepository.AddDataTemplate();
        }
Exemplo n.º 7
0
 // [Todo] Lazy loading
 static void LazyLoading()
 {
     var countyRepo = new CountyRepository();
     //countyRepo.LazyLoadingAddress();
 }
Exemplo n.º 8
0
        // [TAG] Changing relationships
        static void ChangingRelationshipsCounty()
        {
            var countyRepo = new CountyRepository();

            countyRepo.ChangeRelationship();
        }