예제 #1
0
        public async Task GetDocumentsPaginatedAsync_ByOrganizationReceiver_Success()
        {
            var cabinetContext = new CabinetContext(_dbOptions);
            var docType        = TestHelper.GetFakeDocumentType();

            cabinetContext.DocumentTypes.Add(docType);
            cabinetContext.SaveChanges();
            var document = TestHelper.GetFakeDocument();

            document.DocumentTypeID = docType.ID;
            cabinetContext.Documents.Add(document);
            cabinetContext.SaveChanges();
            var searchParameters = new DocumentsFilter
            {
                OrganizationReceiverID = document.OrganizationID
            };
            var documentService = new DocumentService(cabinetContext, _documentManager);

            var documents = await documentService.GetDocumentsPaginatedAsync(searchParameters, 50, 0);

            Assert.AreEqual(0, documents.Data.Count());
        }
예제 #2
0
        public void CleanUp()
        {
            var directories = Directory.GetDirectories(_testDirectory);

            foreach (string dir in directories)
            {
                var files = Directory.GetFiles(dir);
                foreach (var file in files)
                {
                    File.Delete(file);
                }

                Directory.Delete(dir);
            }
            Directory.Delete(_testDirectory);
            var cabinetContext = new CabinetContext(_dbOptions);

            cabinetContext.Documents.RemoveRange(cabinetContext.Documents);
            cabinetContext.DocumentTypes.RemoveRange(cabinetContext.DocumentTypes);
            cabinetContext.DocumentsAccesses.RemoveRange(cabinetContext.DocumentsAccesses);
            cabinetContext.SaveChanges();
        }