Esempio n. 1
0
        public async Task GetFilesAsync_Test()
        {
            var testItems = new DmsFileView[]
            {
                new DmsFileView {
                    Name = "Test"
                },
                new DmsFileView {
                    Name = "Test2"
                }
            };

            var mockFileService = new Mock <IDmsFileService>();

            mockFileService.Setup(x => x.GetFileViewsAsync())
            .Returns(Task.FromResult <IEnumerable <DmsFileView> >(testItems))
            .Verifiable();

            var contorller = new PdfController(mockFileService.Object);

            //Act
            var result = await contorller.GetAsync();

            //Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count() == 2);
        }
Esempio n. 2
0
        public async Task GetFileViewAsync_Test()
        {
            var beforeCount = await _context.DmsFiles.CountAsync();

            var dmsFileService = new DmsFileService(_context);
            var dmsContorller  = new PdfController(dmsFileService);

            //Act
            var result = await dmsContorller.GetAsync();

            //Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(beforeCount == result.Count());
        }