public void CountrySpecificationsEmptyTextReturnTrueSpecification()
        {
            //Arrange and Act
            var specification = CountrySpecifications.CountryFullText(string.Empty);

            //Assert
            Assert.IsNotNull(specification);
            Assert.IsInstanceOfType(specification, typeof(TrueSpecification <Country>));
        }
        public void CountrySpecificationNotEmptyTextReturnCompisiteSpecification()
        {
            //Arrange and Act
            var specification = CountrySpecifications.CountryFullText("Spain");

            //Assert
            Assert.IsNotNull(specification);
            Assert.IsInstanceOfType(specification, typeof(AndSpecification <Country>));
        }
Example #3
0
        public void CountrySpecificationNotEmptyTextReturnCompisiteSpecification()
        {
            //Arrange and Act
            var specification = CountrySpecifications.CountryFullText("Spain");

            //Assert
            Assert.NotNull(specification);
            Assert.IsType <AndSpecification <Country> >(specification);
        }
Example #4
0
        public void CountrySpecificationsEmptyTextReturnTrueSpecification()
        {
            //Arrange and Act
            var specification = CountrySpecifications.CountryFullText(string.Empty);

            //Assert
            Assert.NotNull(specification);
            Assert.IsType <TrueSpecification <Country> >(specification);
        }
Example #5
0
        public void CountryRepositoryAllMatchingMethodReturnEntitiesWithSatisfiedCriteria()
        {
            //Arrange
            var countryRepository = new CountryRepository(fixture.unitOfWork, fixture.countryLogger);

            string textToFind = "ain";
            var    spec       = CountrySpecifications.CountryFullText(textToFind);

            //Act
            var result = countryRepository.AllMatching(spec);

            //Assert
            Assert.NotNull(result.All(c => c.CountryISOCode.Contains(textToFind) || c.CountryName.Contains(textToFind)));
        }
Example #6
0
        public void CountryRepositoryAllMatchingMethodReturnEntitiesWithSatisfiedCriteria()
        {
            //Arrange
            var unitOfWork        = new MainBcUnitOfWork();
            var countryRepository = new CountryRepository(unitOfWork);

            var textToFind = "ain";
            var spec       = CountrySpecifications.CountryFullText(textToFind);

            //Act
            var result = countryRepository.AllMatching(spec);

            //Assert
            Assert.IsNotNull(result.All(c => c.CountryIsoCode.Contains(textToFind) || c.CountryName.Contains(textToFind)));
        }
Example #7
0
        /// <summary>
        ///    <see
        ///       cref="M:Microsoft.Samples.NLayerApp.Application.MainBoundedContext.ERPModule.Services.ICustomerManagement.FindCountries" />
        /// </summary>
        /// <param name="text">
        ///    <see
        ///       cref="M:Microsoft.Samples.NLayerApp.Application.MainBoundedContext.ERPModule.Services.ICustomerManagement.FindCountries" />
        /// </param>
        /// <returns>
        ///    <see
        ///       cref="M:Microsoft.Samples.NLayerApp.Application.MainBoundedContext.ERPModule.Services.ICustomerManagement.FindCountries" />
        /// </returns>
        public List <CountryDto> FindCountries(string text)
        {
            //get the specification
            var specification = CountrySpecifications.CountryFullText(text);

            //Query this criteria
            var countries = _countryRepository.AllMatching(specification);

            if (countries != null && countries.Any())
            {
                return(countries.ProjectedAsCollection <CountryDto>());
            }
            else // no data
            {
                return(null);
            }
        }