public async Task AddClubAsync_ThrowsException_NullInput()
        {
            //arrange
            IEntityGateway     entityGateway = InMemoryEntityGatewayFactory.CreateEntityGateway();
            IAddClubPresenter  presenter     = new FakeAddClubPresenter(_output);
            IAddClubInteractor interactor    = new AddClubInteractor(presenter, entityGateway);
            AddClubInputModel  inputModel    = null;

            //act
            async Task <CommandResult <AddClubOutputModel> > function() => await interactor.AddClubAsync(inputModel);

            //assert
            await Assert.ThrowsAsync <ArgumentNullException>(function);
        }
        public async Task AddClubAsync_FailedModelValidation_NullName()
        {
            //arrange
            IEntityGateway     entityGateway = InMemoryEntityGatewayFactory.CreateEntityGateway();
            IAddClubPresenter  presenter     = new FakeAddClubPresenter(_output);
            IAddClubInteractor interactor    = new AddClubInteractor(presenter, entityGateway);
            AddClubInputModel  inputModel    = new AddClubInputModel();

            //act
            var result = await interactor.AddClubAsync(inputModel);

            //assert
            Assert.NotNull(result);
            Assert.True(result.Status == Application.Common.CommandResultStatusCode.FailedModelValidation);
            Assert.True(result.ModelValidationErrors.ContainsKey(Domain.Common.ModelValidationStatusCode.RequiredInformationMissing));
        }
        public async Task AddClubAsync_CommandResult_Success()
        {
            //arrange
            IEntityGateway     entityGateway = InMemoryEntityGatewayFactory.CreateEntityGateway();
            IAddClubPresenter  presenter     = new FakeAddClubPresenter(_output);
            IAddClubInteractor interactor    = new AddClubInteractor(presenter, entityGateway);
            AddClubInputModel  inputModel    = new AddClubInputModel {
                Name = "C# Knights"
            };

            //act
            var result = await interactor.AddClubAsync(inputModel);

            //assert
            Assert.NotNull(result);
            Assert.True(result.Status == Application.Common.CommandResultStatusCode.Success);
            Assert.Null(result.ModelValidationErrors);
            Assert.NotNull(result.OutputModel);
            Assert.True(result.OutputModel.Id != Guid.Empty);
        }
        public async Task AddClubAsyncExistingClubNameDifferentCase_CommandResult_DuplicateEntry()
        {
            //arrange
            string duplicatedClubName = "C# Knights";
            var    clubsToPreload     = new Club[] { new Club {
                                                         Name = duplicatedClubName
                                                     } };
            IEntityGateway entityGateway = await InMemoryEntityGatewayFactory.CreateEntityGatewayAsync(clubsToPreload);

            IAddClubPresenter  presenter  = new FakeAddClubPresenter(_output);
            IAddClubInteractor interactor = new AddClubInteractor(presenter, entityGateway);
            AddClubInputModel  inputModel = new AddClubInputModel {
                Name = duplicatedClubName.ToLowerInvariant()
            };

            //act
            var result = await interactor.AddClubAsync(inputModel);

            //assert
            Assert.NotNull(result);
            Assert.True(result.Status == Application.Common.CommandResultStatusCode.DuplicateEntry);
        }