public async void Get_null_record() { var mock = new ServiceMockFacade <IApiKeyRepository>(); mock.RepositoryMock.Setup(x => x.Get(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.Get(default(string)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>())); }
public async void ByApiKeyHashed_Exists() { var mock = new ServiceMockFacade <IApiKeyRepository>(); var record = new ApiKey(); mock.RepositoryMock.Setup(x => x.ByApiKeyHashed(It.IsAny <string>())).Returns(Task.FromResult(record)); 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().NotBeNull(); mock.RepositoryMock.Verify(x => x.ByApiKeyHashed(It.IsAny <string>())); }
public async void TestGet() { ApiApiKeyResponseModel response = await this.Client.ApiKeyGetAsync("A"); response.Should().NotBeNull(); }