Beispiel #1
0
        public static AddressObjectType CreateNew(int depth = 0)
        {
            rt.fias.model.fias.AddressObjectType entity = new rt.fias.model.fias.AddressObjectType();

            // You may need to maually enter this key if there is a constraint violation.
            entity.Id = "Tes";

            entity.Level    = 34;
            entity.Scname   = "T";
            entity.Socrname = "Test Test Test Tes";

            return(entity);
        }
Beispiel #2
0
        public void Create()
        {
            try
            {
                rt.fias.model.fias.AddressObjectType entity = CreateNew();

                object result = manager.Save(entity);

                Assert.IsNotNull(result);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Beispiel #3
0
        public void Read()
        {
            try
            {
                rt.fias.model.fias.AddressObjectType entityA = CreateNew();
                manager.Save(entityA);

                rt.fias.model.fias.AddressObjectType entityB = manager.GetById(entityA.Id);

                Assert.AreEqual(entityA, entityB);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Beispiel #4
0
        public void Delete()
        {
            try
            {
                rt.fias.model.fias.AddressObjectType entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.fias.model.fias.AddressObjectType entity = GetFirstAddressObjectType();

                manager.Delete(entity);

                entity = manager.GetById(entity.Id);
                Assert.IsNull(entity);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Beispiel #5
0
        public void Update()
        {
            try
            {
                rt.fias.model.fias.AddressObjectType entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.fias.model.fias.AddressObjectType entityA = GetFirstAddressObjectType();

                entityA.Level = 80;

                manager.Update(entityA);

                rt.fias.model.fias.AddressObjectType entityB = manager.GetById(entityA.Id);

                Assert.AreEqual(entityA.Level, entityB.Level);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }