public async Task ExecuteAsync_WhenCommandIsNotNull_AssertToDomainWasCalledOnPushKeyValueEntryCommand()
        {
            CommandHandler sut = CreateSut();

            Mock <IPushKeyValueEntryCommand> pushKeyValueEntryCommandMock = BuildPushKeyValueEntryCommandMock();
            await sut.ExecuteAsync(pushKeyValueEntryCommandMock.Object);

            pushKeyValueEntryCommandMock.Verify(m => m.ToDomain(), Times.Once);
        }
        public async Task ExecuteAsync_WhenCommandIsNotNull_AssertPushKeyValueEntryAsyncWasCalledOnCommonRepository()
        {
            CommandHandler sut = CreateSut();

            IKeyValueEntry            keyValueEntry            = _fixture.BuildKeyValueEntryMock <object>().Object;
            IPushKeyValueEntryCommand pushKeyValueEntryCommand = BuildPushKeyValueEntryCommand(keyValueEntry);
            await sut.ExecuteAsync(pushKeyValueEntryCommand);

            _commonRepositoryMock.Verify(m => m.PushKeyValueEntryAsync(It.Is <IKeyValueEntry>(value => value != null && value == keyValueEntry)), Times.Once);
        }
        public async Task ExecuteAsync_WhenCommandIsNotNull_AssertValidateWasCalledOnPushKeyValueEntryCommand()
        {
            CommandHandler sut = CreateSut();

            Mock <IPushKeyValueEntryCommand> pushKeyValueEntryCommandMock = BuildPushKeyValueEntryCommandMock();
            await sut.ExecuteAsync(pushKeyValueEntryCommandMock.Object);

            pushKeyValueEntryCommandMock.Verify(m => m.Validate(
                                                    It.Is <IValidator>(value => value != null && value == _validatorMock.Object),
                                                    It.Is <ICommonRepository>(value => value != null && value == _commonRepositoryMock.Object)),
                                                Times.Once);
        }
        public void ExecuteAsync_WhenCommandIsNull_ThrowsArgumentNullException()
        {
            CommandHandler sut = CreateSut();

            ArgumentNullException result = Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.ExecuteAsync(null));

            // ReSharper disable PossibleNullReferenceException
            Assert.That(result.ParamName, Is.EqualTo("command"));
            // ReSharper restore PossibleNullReferenceException
        }