Esempio n. 1
0
        public async Task GetPdfs_NoResults_ReturnsArrayOfStorageItems()
        {
            var mockLogger        = new Mock <ILogger <PdfsController> >();
            var mockStorageClient = new Mock <IApiRepository>();

            mockStorageClient
            .Setup(c => c.GetAllItems(It.IsAny <string>()));
            var controller = new PdfsController(mockLogger.Object, mockStorageClient.Object);

            var result = await controller.GetPdfs();

            (result.Result as ObjectResult).Value.Should().BeOfType <StoredItem[]>();
        }
Esempio n. 2
0
        public async Task GetPdfs_OneResult_ReturnsArrayOfStorageItems()
        {
            var testResults = new List <StoredItem> {
                new StoredItem()
                {
                    FileSize = 0, Location = "location", Name = "name"
                }
            };
            var mockLogger        = new Mock <ILogger <PdfsController> >();
            var mockStorageClient = new Mock <IApiRepository>();

            mockStorageClient.Setup(c => c.GetAllItems(It.IsAny <string>())).Returns(Task.FromResult(testResults.AsEnumerable()));
            var controller = new PdfsController(mockLogger.Object, mockStorageClient.Object);

            var result = await controller.GetPdfs();

            (result.Result as ObjectResult).Value.Should().BeEquivalentTo(testResults);
        }