public async Task DomainService_DirectQuery() { DomainServiceDescription description = DomainServiceDescription.GetDescription(typeof(TestDomainServices.EF.Catalog)); TestDomainServices.EF.Catalog service = new TestDomainServices.EF.Catalog(); DomainServiceContext dsc = new DomainServiceContext(new MockDataService(new MockUser("mathew") { IsAuthenticated = true }), DomainOperationType.Query); service.Initialize(dsc); DomainOperationEntry queryOperation = description.GetQueryMethod("GetPurchaseOrders"); ServiceQuery serviceQuery = new ServiceQuery(); serviceQuery.QueryParts = new ServiceQueryPart[] { new ServiceQueryPart("where", "(it.Freight!=0)"), new ServiceQueryPart("take", "1") }; QueryResult <AdventureWorksModel.PurchaseOrder> result = await QueryProcessor.ProcessAsync <AdventureWorksModel.PurchaseOrder>(service, queryOperation, Array.Empty <object>(), serviceQuery); Assert.AreEqual(1, result.RootResults.Count()); }
public void DomainService_DirectQuery() { DomainServiceDescription description = DomainServiceDescription.GetDescription(typeof(TestDomainServices.EF.Catalog)); TestDomainServices.EF.Catalog service = new TestDomainServices.EF.Catalog(); DomainServiceContext dsc = new DomainServiceContext(new MockDataService(new MockUser("mathew") { IsAuthenticated = true }), DomainOperationType.Query); service.Initialize(dsc); DomainOperationEntry queryOperation = description.GetQueryMethod("GetPurchaseOrders"); ServiceQuery serviceQuery = new ServiceQuery(); serviceQuery.QueryParts = new ServiceQueryPart[] { new ServiceQueryPart("where", "(it.Freight!=0)"), new ServiceQueryPart("take", "1") }; IEnumerable <ValidationResult> validationErrors; int totalCount; QueryResult <AdventureWorksModel.PurchaseOrder> result = QueryProcessor.Process <AdventureWorksModel.PurchaseOrder>(service, queryOperation, new object[0], serviceQuery, out validationErrors, out totalCount); Assert.AreEqual(1, result.RootResults.Count()); }
public void DomainService_DirectQuery() { DomainServiceDescription description = DomainServiceDescription.GetDescription(typeof(TestDomainServices.EF.Catalog)); TestDomainServices.EF.Catalog service = new TestDomainServices.EF.Catalog(); DomainServiceContext dsc = new DomainServiceContext(new MockDataService(new MockUser("mathew") { IsAuthenticated = true }), DomainOperationType.Query); service.Initialize(dsc); DomainOperationEntry queryOperation = description.GetQueryMethod("GetPurchaseOrders"); ServiceQuery serviceQuery = new ServiceQuery(); serviceQuery.QueryParts = new ServiceQueryPart[] { new ServiceQueryPart("where", "(it.Freight!=0)"), new ServiceQueryPart("take", "1") }; IEnumerable<ValidationResult> validationErrors; int totalCount; QueryResult<AdventureWorksModel.PurchaseOrder> result = QueryProcessor.Process<AdventureWorksModel.PurchaseOrder>(service, queryOperation, new object[0], serviceQuery, out validationErrors, out totalCount); Assert.AreEqual(1, result.RootResults.Count()); }