Пример #1
0
        public async Task TestGet_CheckProperties()
        {
            var gender = new Gender
            {
                GenderId   = 1,
                GenderName = "genderName"
            };

            context.Genders.Add(gender);

            Action <PagedQueryResults <SimpleLookupDTO> > tester = (results) =>
            {
                Assert.AreEqual(1, results.Total);
                Assert.AreEqual(1, results.Results.Count);

                var firstResult = results.Results.First();
                Assert.AreEqual(gender.GenderId, firstResult.Id);
                Assert.AreEqual(gender.GenderName, firstResult.Value);
            };

            var defaultSorter = new ExpressionSorter <SimpleLookupDTO>(x => x.Id, SortDirection.Ascending);
            var queryOperator = new QueryableOperator <SimpleLookupDTO>(0, 10, defaultSorter);

            var serviceResults      = service.Get(queryOperator);
            var serviceResultsAsync = await service.GetAsync(queryOperator);
        }