示例#1
0
        public void DomainModelCRUDTest()
        {
            var dataObject  = DomainModelBuilder.CreateDataObject();
            var domainModel = DomainModelBuilder.CreateDomainModel();

            var dataObjectManager  = new NSharding.DomainModel.Manager.DataObjectManager();
            var domainModelManager = new NSharding.DomainModel.Manager.DomainModelManager();

            try
            {
                dataObjectManager.DeleteDataObject(dataObject.ID);
                dataObjectManager.SaveDataObject(dataObject);

                domainModelManager.DeleteDomainModel(domainModel.ID);
                domainModelManager.SaveDomainModel(domainModel);

                var queryModel = domainModelManager.GetDomainModel(domainModel.ID);
                DomainModelAssert.AreEqual(domainModel, queryModel);
            }
            finally
            {
                dataObjectManager.DeleteDataObject(dataObject.ID);
                domainModelManager.DeleteDomainModel(domainModel.ID);
            }
        }
示例#2
0
        public void SalesOrderCRUDTest()
        {
            var dataObject  = DomainModelBuilder.CreateDataObject();
            var domainModel = DomainModelBuilder.CreateDomainModel();

            var dataObjectManager  = new NSharding.DomainModel.Manager.DataObjectManager();
            var domainModelManager = new NSharding.DomainModel.Manager.DomainModelManager();

            try
            {
                dataObjectManager.DeleteDataObject(dataObject.ID);
                dataObjectManager.SaveDataObject(dataObject);

                domainModelManager.DeleteDomainModel(domainModel.ID);
                domainModelManager.SaveDomainModel(domainModel);

                var orders = OrderAssert.CreateOrders();

                DataAccessService.GetInstance().Save(domainModel.ID, orders);
                var dataTables = DataAccessService.GetInstance().GetData(domainModel.ID, orders.ID);
                Assert.IsNotNull(dataTables);
            }
            finally
            {
                dataObjectManager.DeleteDataObject(dataObject.ID);
                domainModelManager.DeleteDomainModel(domainModel.ID);
            }
        }