コード例 #1
0
        private Estado AddCity(IAddressModelService service, int i, Estado e)
        {
            Cidade p = service.CreateObject <Cidade>();

            p.Nome = "Teste " + i.ToString();
            p.DDD  = "00";

            //var aux = container.Resolve<IAddressModelService>();


            //var est = aux.Context.Estados.Single<Estado>(g => g.ID == 1);
            //aux.Context.Detach(est);
            var est = service.Context.Estados.Single <Estado>(g => g.ID == 1);

            // var r = est.Equals(e);

            //service.Context.Estados.Detach(est);
            //est.StartTracking();

            p.Estado = est;

            //if (e == null) {
            //    service.Context.Estados.Attach(est);
            //    p.Estado = est;
            //}
            //else
            //    p.Estado = e;

            service.AddCity(p);
            service.Save();

            return(est);
        }
コード例 #2
0
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        private void AddCountry(IAddressModelService service, int i)
        {
            Pais p = service.CreateObject <Pais>();

            p.Nome  = "Teste " + i.ToString();
            p.Sigla = "T" + i.ToString();
            service.AddCountry(p);
            service.Save();
        }
コード例 #3
0
        public void AddCountryTest()
        {
            IAddressModelService target = container.Resolve <IAddressModelService>();

            using (var ts = new TransactionScope())
            {
                for (int i = 1; i < 10; i++)
                {
                    this.AddCountry(target, i);
                }
            }
            Assert.IsTrue(true);
        }
コード例 #4
0
        public void AddCityTest()
        {
            IAddressModelService target = container.Resolve <IAddressModelService>();
            Estado e = null;

            using (var ts = new TransactionScope())
            {
                for (int i = 1; i < 10; i++)
                {
                    e = this.AddCity(target, i, e);
                    //target.Save();
                }
            }

            Assert.IsTrue(true);
        }
コード例 #5
0
 public GetAddressController(IAddressModelService addressModelService)
 {
     _addressModelService = addressModelService;
 }
コード例 #6
0
 public AddressController(IConfiguration configuration, IAddressModelService addressModelService) : base(configuration)
 {
     _addressModelService = addressModelService;
 }