Exemplo n.º 1
0
        public async Task ExecuteAsync_WhenCalled_AssertToDomainWithClientIdAndClientSecretWasNotCalledOnCommand()
        {
            CommandHandler sut = CreateSut();

            Mock <ICreateClientSecretIdentityCommand> commandMock = CreateCommandMock();
            await sut.ExecuteAsync(commandMock.Object);

            commandMock.Verify(m => m.ToDomain(It.IsAny <string>(), It.IsAny <string>()), Times.Never);
        }
Exemplo n.º 2
0
        public async Task ExecuteAsync_WhenCalled_AssertToDomainWithoutClientIdAndClientSecretWasCalledOnCommand()
        {
            CommandHandler sut = CreateSut();

            Mock <ICreateClientSecretIdentityCommand> commandMock = CreateCommandMock();
            await sut.ExecuteAsync(commandMock.Object);

            commandMock.Verify(m => m.ToDomain(), Times.Once);
        }
Exemplo n.º 3
0
        public async Task ExecuteAsync_WhenCalled_AssertCreateClientSecretIdentityAsyncWasCalledOnSecurityRepository()
        {
            CommandHandler sut = CreateSut();

            IClientSecretIdentity clientSecretIdentity = _fixture.BuildClientSecretIdentityMock().Object;
            ICreateClientSecretIdentityCommand command = CreateCommandMock(clientSecretIdentity).Object;
            await sut.ExecuteAsync(command);

            _securityRepositoryMock.Verify(m => m.CreateClientSecretIdentityAsync(It.Is <IClientSecretIdentity>(value => value == clientSecretIdentity)), Times.Once);
        }