示例#1
0
        public async void ByApiKeyHashed_Not_Exists()
        {
            var mock = new ServiceMockFacade <IApiKeyRepository>();

            mock.RepositoryMock.Setup(x => x.ByApiKeyHashed(It.IsAny <string>())).Returns(Task.FromResult <ApiKey>(null));
            var service = new ApiKeyService(mock.LoggerMock.Object,
                                            mock.RepositoryMock.Object,
                                            mock.ModelValidatorMockFactory.ApiKeyModelValidatorMock.Object,
                                            mock.BOLMapperMockFactory.BOLApiKeyMapperMock,
                                            mock.DALMapperMockFactory.DALApiKeyMapperMock);

            ApiApiKeyResponseModel response = await service.ByApiKeyHashed(default(string));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.ByApiKeyHashed(It.IsAny <string>()));
        }