Beispiel #1
0
        public void ApplyLogicForPrincipal_WhenCountryCollectionIsNull_ThrowsArgumentNullException()
        {
            ICountryHelper sut = CreateSut();

            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.ApplyLogicForPrincipal((IEnumerable <ICountry>)null));

            Assert.That(result.ParamName, Is.EqualTo("countryCollection"));
        }
Beispiel #2
0
        public void ApplyLogicForPrincipal_WhenCalledWithCountryCollection_AssertGetCountryCodeWasCalledOnClaimResolver()
        {
            ICountryHelper sut = CreateSut();

            sut.ApplyLogicForPrincipal(_fixture.CreateMany <ICountry>(_random.Next(5, 10)).ToList());

            _claimResolverMock.Verify(m => m.GetCountryCode(), Times.Once);
        }
Beispiel #3
0
        public void ApplyLogicForPrincipal_WhenCalledWithCountry_AssertGetCountryCodeWasCalledOnClaimResolver()
        {
            ICountryHelper sut = CreateSut();

            sut.ApplyLogicForPrincipal(_fixture.Create <ICountry>());

            _claimResolverMock.Verify(m => m.GetCountryCode(), Times.Once);
        }
        public FirstViewModel(IPhoneNumberHelper phoneNumberHelper,
                              ICountryHelper countryHelper)
        {
            _phoneNumberHelper = phoneNumberHelper;
            _countryHelper = countryHelper;

            Countries = _countryHelper.GetListOfCountryNamesAsIsoEnglishShort();
        }
Beispiel #5
0
        public void ApplyLogicForPrincipal_WhenCalledWithCountry_ReturnsCountry()
        {
            ICountryHelper sut = CreateSut();

            ICountry country = _fixture.Create <ICountry>();
            ICountry result  = sut.ApplyLogicForPrincipal(country);

            Assert.That(result, Is.EqualTo(country));
        }
Beispiel #6
0
        public void ApplyLogicForPrincipal_WhenCalledWithCountryCollection_ReturnsCountryCollection()
        {
            ICountryHelper sut = CreateSut();

            IEnumerable <ICountry> countryCollection = _fixture.CreateMany <ICountry>(_random.Next(5, 10)).ToList();
            IEnumerable <ICountry> result            = sut.ApplyLogicForPrincipal(countryCollection);

            Assert.That(result, Is.EqualTo(countryCollection));
        }
        public GetPostalCodeCollectionQueryHandler(IValidator validator, IContactRepository contactRepository, ICountryHelper countryHelper)
        {
            NullGuard.NotNull(validator, nameof(validator))
            .NotNull(contactRepository, nameof(contactRepository))
            .NotNull(countryHelper, nameof(countryHelper));

            _validator         = validator;
            _contactRepository = contactRepository;
            _countryHelper     = countryHelper;
        }
Beispiel #8
0
        public void ApplyLogicForPrincipal_WhenCalledWithCountry_AssertApplyDefaultForPrincipalWasCalledOnCountry()
        {
            string         countryCode = _fixture.Create <string>();
            ICountryHelper sut         = CreateSut(countryCode);

            Mock <ICountry> countryMock = _fixture.BuildCountryMock();

            sut.ApplyLogicForPrincipal(countryMock.Object);

            countryMock.Verify(m => m.ApplyDefaultForPrincipal(It.Is <string>(value => string.CompareOrdinal(value, countryCode) == 0)), Times.Once());
        }
Beispiel #9
0
        public void ApplyLogicForPrincipal_WhenCalledWithCountryCollection_AssertApplyDefaultForPrincipalWasCalledOnEachCountry()
        {
            string         countryCode = _fixture.Create <string>();
            ICountryHelper sut         = CreateSut(countryCode);

            IEnumerable <Mock <ICountry> > countryMockCollection = new List <Mock <ICountry> >
            {
                _fixture.BuildCountryMock(),
                                           _fixture.BuildCountryMock(),
                                           _fixture.BuildCountryMock()
            };

            sut.ApplyLogicForPrincipal(countryMockCollection.Select(countryMock => countryMock.Object).ToList());

            foreach (Mock <ICountry> countryMock in countryMockCollection)
            {
                countryMock.Verify(m => m.ApplyDefaultForPrincipal(It.Is <string>(value => string.CompareOrdinal(value, countryCode) == 0)), Times.Once());
            }
        }
        public GetCountryCollectionQueryHandler(IContactRepository contactRepository, ICountryHelper countryHelper)
        {
            NullGuard.NotNull(contactRepository, nameof(contactRepository))
            .NotNull(countryHelper, nameof(countryHelper));

            _contactRepository = contactRepository;
            _countryHelper     = countryHelper;
        }
 public QueryTests(TestClassFixture fixture)
 {
     _fixture       = fixture;
     _countryHelper = (ICountryHelper)_fixture.Server.Host.Services.GetService(typeof(ICountryHelper));
 }