コード例 #1
0
        public async Task GetFilesDataAsyncMethodReturnsCorrectTypeTest()
        {
            var fileDataId = Guid.NewGuid();
            var mockFilesPersistenceService = new Mock <IFilesPersistenceService>();
            var persistenceController       = new FilesPersistenceController(mockFilesPersistenceService.Object);

            var result = await persistenceController.GetFileDataAsync(fileDataId);

            Assert.AreEqual(typeof(OkNegotiatedContentResult <FilePersistenceServiceResponseDto>), result.GetType());
        }
コード例 #2
0
        public async Task GetFilesDataAsyncMethodCallsCorrectServiceMethodTest()
        {
            var fileDataId = Guid.NewGuid();
            var mockFilesPersistenceService = new Mock <IFilesPersistenceService>();
            var persistenceController       = new FilesPersistenceController(mockFilesPersistenceService.Object);

            await persistenceController.GetFileDataAsync(fileDataId);

            mockFilesPersistenceService.Verify(m => m.GetFileDataAsync(fileDataId), Times.Once());
        }