Exemple #1
0
        public async Task QueryAsync_WhenCalledAndCountryWasNotReturnedFromContactRepository_AssertApplyLogicForPrincipalWasNotCalledOnCountryHelper()
        {
            QueryHandler sut = CreateSut(false);

            IGetCountryQuery query = CreateQueryMock().Object;
            await sut.QueryAsync(query);

            _countryHelperMock.Verify(m => m.ApplyLogicForPrincipal(It.IsAny <ICountry>()), Times.Never);
        }
Exemple #2
0
        public async Task QueryAsync_WhenCalledAndCountryWasNotReturnedFromContactRepository_ReturnsNull()
        {
            QueryHandler sut = CreateSut(false);

            IGetCountryQuery query  = CreateQueryMock().Object;
            ICountry         result = await sut.QueryAsync(query);

            Assert.That(result, Is.Null);
        }
Exemple #3
0
        public async Task QueryAsync_WhenCalled_AssertGetCountryAsyncWasCalledOnContactRepository()
        {
            QueryHandler sut = CreateSut();

            string           countryCode = _fixture.Create <string>();
            IGetCountryQuery query       = CreateQueryMock(countryCode).Object;
            await sut.QueryAsync(query);

            _contactRepositoryMock.Verify(m => m.GetCountryAsync(It.Is <string>(value => string.CompareOrdinal(value, countryCode) == 0)), Times.Once);
        }
Exemple #4
0
        public async Task QueryAsync_WhenCalledAndCountryWasReturnedFromContactRepository_ReturnsCountryFromCountryHelper()
        {
            ICountry     country = _fixture.BuildCountryMock().Object;
            QueryHandler sut     = CreateSut(country: country);

            IGetCountryQuery query  = CreateQueryMock().Object;
            ICountry         result = await sut.QueryAsync(query);

            Assert.That(result, Is.EqualTo(country));
        }
Exemple #5
0
        public async Task QueryAsync_WhenCalledAndCountryWasReturnedFromContactRepository_AssertApplyLogicForPrincipalWasCalledOnCountryHelperWithCountryFromContactRepository()
        {
            ICountry     country = _fixture.BuildCountryMock().Object;
            QueryHandler sut     = CreateSut(country: country);

            IGetCountryQuery query = CreateQueryMock().Object;
            await sut.QueryAsync(query);

            _countryHelperMock.Verify(m => m.ApplyLogicForPrincipal(It.Is <ICountry>(value => value == country)), Times.Once);
        }
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     IEmailSender emailSender,
     ILogger <AccountController> logger,
     IUserFactory userFactory,
     IMuseumFactory museumFactory,
     IRegisterViewModelFactory registerViewModelFactory,
     IGetCountryQuery getCountryQuery,
     IRemoveMuseumCommand removeMuseumCommand)
 {
     this.userManager              = userManager;
     this.signInManager            = signInManager;
     this.emailSender              = emailSender;
     this.logger                   = logger;
     this.userFactory              = userFactory;
     this.museumFactory            = museumFactory;
     this.registerViewModelFactory = registerViewModelFactory;
     this.getCountryQuery          = getCountryQuery;
     this.removeMuseumCommand      = removeMuseumCommand;
 }
Exemple #7
0
 public MuseumFactory(IGetCountryQuery getCountryQuery)
 {
     this.getCountryQuery = getCountryQuery;
 }
 public IActionResult Get(int id, [FromServices] IGetCountryQuery query)
 {
     return(Ok(_executor.ExecuteQuery(query, id)));
 }