public void FindCountriesByFilterReturnNullIfNotData()
      {
         //Arrange
         var customerRepository = new StubICustomerRepository();
         var countryRepository = new StubICountryRepository();
         countryRepository.AllMatchingISpecificationOfCountry = (spec) => { return new List<Country>(); };

         var customerManagementService = new CustomerAppService(countryRepository, customerRepository);

         //Act
         var result = customerManagementService.FindCountries("filter");

         //Assert
         Assert.IsNull(result);
      }
      public void FindCountriesInPageMaterializeResults()
      {
         //Arrange
         var customerRepository = new StubICustomerRepository();
         var countryRepository = new StubICountryRepository();
/*         countryRepository.GetPagedInt32Int32ExpressionOfFuncOfCountryKPropertyBoolean<string>(
            (index, count, order, ascending) =>
            {
               var country = new Country("country name", "country iso");
               country.GenerateNewIdentity();

               return new List<Country>()
               {
                  country
               };
            });*/
         countryRepository.GetPagedOf1Int32Int32ExpressionOfFuncOfCountryM0Boolean<string>(
            (index, count, order, ascending) =>
            {
               var country = new Country("country name", " country iso");
               country.GenerateNewIdentity();
               return new List<Country>()
               {
                  country
               };
            });

         var customerManagementService = new CustomerAppService(countryRepository, customerRepository);

         //Act
         var result = customerManagementService.FindCountries(0, 1);

         //Assert
         Assert.IsNotNull(result);
         Assert.IsTrue(result.Count == 1);
      }
      public void FindCountriesByFilterMaterializeResults()
      {
         //Arrange
         var customerRepository = new StubICustomerRepository();
         var countryRepository = new StubICountryRepository();
         countryRepository.AllMatchingISpecificationOfCountry = (spec) =>
         {

            var country = new Country("country name", "country iso");
            country.GenerateNewIdentity();

            return new List<Country>()
            {
               country
            };
         };

         var customerManagementService = new CustomerAppService(countryRepository, customerRepository);

         //Act
         var result = customerManagementService.FindCountries("filter");

         //Assert
         Assert.IsNotNull(result);
         Assert.IsTrue(result.Count == 1);
      }
      public void FindCountriesInPageReturnNullIfNotData()
      {
         //Arrange
         var customerRepository = new StubICustomerRepository();
         var countryRepository = new StubICountryRepository();
         //countryRepository.GetPagedInt32Int32ExpressionOfFuncOfCountryKPropertyBoolean<string>(
         //   (index, count, order, ascending) => { return new List<Country>(); });

         countryRepository.GetPagedOf1Int32Int32ExpressionOfFuncOfCountryM0Boolean<string>(
            (index, count, order, ascending) => new List<Country>());

         var customerManagementService = new CustomerAppService(countryRepository, customerRepository);

         //Act
         var result = customerManagementService.FindCountries(0, 1);

         //Assert
         Assert.IsNull(result);
      }
      public void FindCountriesWithInvalidPageArgumentsReturnNull()
      {
         //Arrange
         var countryRepository = new StubICountryRepository();
         var customerRepository = new StubICustomerRepository();

         var customerManagementService = new CustomerAppService(countryRepository, customerRepository);

         //Act
         customerManagementService.FindCountries(-1, 0);
      }
        public void FindCountriesWithInvalidPageArgumentsReturnNull()
        {
            //Arrange
            var adapter = PrepareTypeAdapter();
            var countryRepository = new SICountryRepository();
            var customerRepository = new SICustomerRepository();

            var customerManagementService = new CustomerAppService(adapter, countryRepository, customerRepository);

            //Act
            var resultInvalidPageIndex = customerManagementService.FindCountries(-1, 0);
            var resultInvalidPageCount = customerManagementService.FindCountries(1, 0);

            //Assert
            Assert.IsNull(resultInvalidPageIndex);
            Assert.IsNull(resultInvalidPageCount);
        }
        public void FindCountriesInPageMaterializeResults()
        {
            //Arrange
            var adapter = PrepareTypeAdapter();
            var customerRepository = new SICustomerRepository();
            var countryRepository = new SICountryRepository();
            countryRepository.GetPagedInt32Int32ExpressionOfFuncOfCountryKPropertyBoolean<string>((index, count, order, ascending) =>
            {
                return new List<Country>()
                {
                    new Country(){Id = Guid.NewGuid(),CountryName ="country name",CountryISOCode="country iso"}
                };
            });

            var customerManagementService = new CustomerAppService(adapter, countryRepository, customerRepository);

            //Act
            var result = customerManagementService.FindCountries(0, 1);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count == 1);
        }
        public void FindCountriesByFilterMaterializeResults()
        {
            //Arrange
            var adapter = PrepareTypeAdapter();
            var customerRepository = new SICustomerRepository();
            var countryRepository = new SICountryRepository();
            countryRepository.AllMatchingISpecificationOfCountry = (spec)=>
            {
                return new List<Country>()
                {
                    new Country(){Id = Guid.NewGuid(),CountryName ="country name",CountryISOCode="country iso"}
                };
            };

            var customerManagementService = new CustomerAppService(adapter, countryRepository, customerRepository);

            //Act
            var result = customerManagementService.FindCountries("filter");

            //Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count == 1);
        }