public async Task QueryAsync_WhenCalled_AssertIdentifierWasCalledOnGetClientSecretIdentityQuery() { QueryHandler sut = CreateSut(); Mock <IGetClientSecretIdentityQuery> queryMock = CreateQueryMock(); await sut.QueryAsync(queryMock.Object); queryMock.Verify(m => m.Identifier, Times.Once); }
public async Task QueryAsync_WhenCalled_ReturnsClientSecretIdentityFromSecurityRepository() { IClientSecretIdentity clientSecretIdentity = _fixture.Create <IClientSecretIdentity>(); QueryHandler sut = CreateSut(clientSecretIdentity); IGetClientSecretIdentityQuery query = CreateQueryMock().Object; IClientSecretIdentity result = await sut.QueryAsync(query); Assert.That(result, Is.EqualTo(clientSecretIdentity)); }
public async Task QueryAsync_WhenCalled_AssertGetClientSecretIdentityAsyncWasCalledOnSecurityRepository() { QueryHandler sut = CreateSut(); int identifier = _fixture.Create <int>(); IGetClientSecretIdentityQuery query = CreateQueryMock(identifier).Object; await sut.QueryAsync(query); _securityRepositoryMock.Verify(m => m.GetClientSecretIdentityAsync(It.Is <int>(value => value == identifier)), Times.Once()); }
public async Task QueryAsync_WhenCalled_AssertValidateWasCalledOnGetClientSecretIdentityQuery() { QueryHandler sut = CreateSut(); Mock <IGetClientSecretIdentityQuery> queryMock = CreateQueryMock(); await sut.QueryAsync(queryMock.Object); queryMock.Verify(m => m.Validate( It.Is <IValidator>(value => value == _validatorMock.Object), It.Is <ISecurityRepository>(value => value == _securityRepositoryMock.Object)), Times.Once); }
public void QueryAsync_WhenQueryIsNull_ThrowsArgumentNullException() { QueryHandler sut = CreateSut(); ArgumentNullException result = Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.QueryAsync(null)); Assert.That(result.ParamName, Is.EqualTo("query")); }