Ejemplo n.º 1
0
        public async Task Given_ACountryWithANullAlpha2Code_When_ValidateContractIsInvoked_Then_CountriesDalGetMatchingCountriesMethodShouldBeInvokedOnce()
        {
            MockCountriesDal.Setup(m => m.GetMatchingCountries(It.Is <CountryDto>(c => c.Alpha2Code == null))).ReturnsAsync(new CountryDto[0]);

            await CountryValidator.ValidateContract(new Country { Alpha2Code = null, FullName = FullName });

            MockCountriesDal.Verify(m => m.GetMatchingCountries(It.IsAny <CountryDto>()), Times.Once);
        }
Ejemplo n.º 2
0
        public async Task Given_AValidCountry_When_ValidateContractIsInvoked_Then_CountriesDalGetMatchingCountriesMethodShouldOnlyBeInvokedOnce()
        {
            MockCountriesDal.Setup(m => m.GetMatchingCountries(It.IsAny <CountryDto>())).ReturnsAsync(new CountryDto[0]);
            MockCountriesDal.Setup(m => m.Create(It.IsAny <CountryDto>())).ReturnsAsync(new CountryDto());

            await CountryValidator.ValidateContract(new Country { FullName = FullName, Alpha2Code = Alpha2Code });

            MockCountriesDal.Verify(m => m.GetMatchingCountries(It.IsAny <CountryDto>()), Times.Once);
        }