Пример #1
0
        public void Should_Create_with_DictionaryTable()
        {
            Dictionary dictionary = new Dictionary
            {
                Code             = 100,
                CompanyId        = 1,
                CreatedBy        = 1,
                DateAdded        = DateTime.Now,
                DateUpdated      = DateTime.Now,
                DepartmentId     = 1,
                Description      = "",
                DictionaryType   = "INSERTED",
                FullDescription  = "INSERTED",
                Hierarchy        = 1,
                Id2              = 1,
                Id3              = 1,
                UpdatedBy        = 1,
                IsDeleted        = false,
                DictionaryTypeId = 20
            };

            var ctx = new WorkBenchContext();
            var dictionaryService = new DictionaryService(
                new UnitOfWork(ctx),
                new GenericDataRepository <Dictionary>(new WorkBenchContext())
                );

            Assert.DoesNotThrow(() =>
            {
                dictionaryService.Create(dictionary);
                dictionaryService.Update(dictionary);
                dictionaryService.GetAll();
                dictionaryService.Delete(dictionary);
            });
        }
        public void Should_Do_JobFormResultsView_Join_Linq_Query()
        {
            using (var ctx = new WorkBenchContext())
            {
                Locator.SetContainer(new Container());
                Locator.Current.Register <ICacheProvider>(() => new MemoryCacheProvider());
                var jobFormResultsViewRepository = new GenericCacheRepository <JobFormResultsView>(ctx);

                var result = jobFormResultsViewRepository.GetAll();
                Assert.That(result, Is.Not.Null.Or.Empty);
            }
        }
        public void Should_Do_Complex_Query_Paged()
        {
            using (var ctx = new WorkBenchContext())
            {
                Locator.SetContainer(new Container());
                Locator.Current.Register <ICacheProvider>(() => new MemoryCacheProvider());

                var repository = new DictionaryCacheRepository(ctx);
                var result     = repository.GetPagedList(x => x != null, 0, 1);

                Assert.That(result, Is.Not.Null.Or.Empty);
                Assert.That(result.Count, Is.EqualTo(1));
            }
        }