예제 #1
0
        protected ServiceBase(string accessKey, string secretKey, string associateTag)
        {
            AccessKey = accessKey;
            AssociateTag = associateTag;

            var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport) { MaxReceivedMessageSize = int.MaxValue };
            client = new AWSECommerceServicePortTypeClient(
                binding,
                new EndpointAddress("https://webservices.amazon.com/onca/soap?Service=AWSECommerceService"));

            client.ChannelFactory.Endpoint.Behaviors.Add(
                new AmazonSigningEndpointBehavior(accessKey, secretKey));
            Merchant = Merchants.All;
            SetupUSBrowserNodes();
        }
예제 #2
0
        public void TestFor_ValidDisplayOfServicesAndGoods()
        {
            //Arrange
            Merchants merchants = new Merchants()
            {
                MerchantsId   = 1,
                MerchantsName = "Mar",
                Email         = "*****@*****.**",
                Password      = "******",
                Mobile        = 9876554345
            };

            //Actions
            var allServices = _merchantService.DisplayServices(merchants.MerchantsId);
            var allGoods    = _merchantService.DisplayAllGoods(merchants.MerchantsId);

            //Assert
            Assert.NotNull(allServices);
            Assert.NotNull(allGoods);
            Assert.NotEmpty(allServices);
            Assert.NotEmpty(allGoods);
        }
        public void ExceptionTestFor_ValidUserName_InvalidPassword()
        {
            Users user = new Users()
            {
                UserId   = 1,
                UserName = "******",
                Email    = "*****@*****.**",
                Password = "******",
            };
            Merchants merchants = new Merchants()
            {
                MerchantsId   = 1,
                MerchantsName = "Mary",
                Email         = "*****@*****.**",
                Password      = "******",
                Mobile        = 9876554345
            };
            //Assert
            var ex  = Assert.Throws <InvalidCredentialsExceptions>(() => _userService.SignIn(user.UserName, user.Password));
            var exc = Assert.Throws <InvalidCredentialsExceptions>(() => _merchantService.SignIn(merchants.MerchantsName, merchants.Password));

            Assert.Equal("Please enter valid usename & password", ex.Messages);
            Assert.Equal("Please enter valid usename & password", exc.Messages);
        }
        public void ExceptionTestFor_UserNotFound()
        {
            //Assert
            Users user = new Users()
            {
                UserId   = random.Next(100, 10000000),
                UserName = "******",
                Email    = "*****@*****.**",
                Password = "******",
            };
            Merchants merchants = new Merchants()
            {
                MerchantsId   = random.Next(100, 10000000),
                MerchantsName = "Mary",
                Email         = "*****@*****.**",
                Password      = "******",
                Mobile        = 9876554345
            };
            var ex  = Assert.Throws <UserNotFoundException>(() => _userService.SignIn(user.UserName, user.Password));
            var exc = Assert.Throws <UserNotFoundException>(() => _merchantService.SignIn(merchants.MerchantsName, merchants.Password));

            Assert.Equal("User Not Found ", ex.Messages);
            Assert.Equal("User Not Found ", exc.Messages);
        }
예제 #5
0
        public void SummingUpYear()
        {
            Age++;
            Merchants.Sort((a, b) => b.Gold.CompareTo(a.Gold));

            Console.WriteLine("All merchants and they gold:");
            PrintAllMerchants();

            Console.WriteLine("20% of the most unsuccessful merchants, who will be excluded:");

            Int32 toDelete      = Merchants.Count / 5;
            Int32 eightyPercent = Merchants.Count - toDelete;

            for (int i = Merchants.Count - 1; i >= eightyPercent; i--)
            {
                Console.WriteLine("\tPlace #" + (i + 1) + " " + Merchants[i].Name + " with " + Merchants[i].Gold + " gold");
                Merchants.RemoveAt(i);
            }
            Console.WriteLine();

            Console.WriteLine("New merchants:");
            for (int i = 0; i < toDelete; i++)
            {
                MerchantTypes type = Merchants[i].OwnType;
                switch (type)
                {
                case MerchantTypes.altruist: {
                    Merchants.Add(new Altruist("Altruist_" + Age + "_" + i, this));
                    break;
                }

                case MerchantTypes.quirky: {
                    Merchants.Add(new Quirky("Quirky_" + Age + "_" + i, this));
                    break;
                }

                case MerchantTypes.resentful: {
                    Merchants.Add(new Resentful("Resentful_" + Age + "_" + i, this));
                    break;
                }

                case MerchantTypes.slyboots: {
                    Merchants.Add(new Slyboots("Slyboots_" + Age + "_" + i, this));
                    break;
                }

                case MerchantTypes.swindler: {
                    Merchants.Add(new Swindler("Swindler_" + Age + "_" + i, this));
                    break;
                }

                case MerchantTypes.unpredictable: {
                    Merchants.Add(new Unpredictable("Unpredictable_" + Age + "_" + i, this));
                    break;
                }
                }
                Console.WriteLine("\t" + Merchants.Last().Name);
            }
            Console.WriteLine();

            foreach (var item in Merchants)
            {
                item.NullifyGold();
            }

            Deals = new List <Deal>();

            IsSummedUp = true;
        }
예제 #6
0
 public void AddMerchant(Merchant merchant)
 {
     Merchants.Add(merchant);
 }
예제 #7
0
 public Response Put([FromBody] Merchants value)
 {
     return(repo.Update(value));
 }
예제 #8
0
 public bool MakePayment(Merchants merchant, Payment payment)
 {
     throw new NotImplementedException();
 }
예제 #9
0
 public ItemSearchResponse ItemSearch(SearchIndex index, string keywords, int page, List <ResponseGroup> responseGroups,
                                      Merchants merchant, int maxPrice, int minPrice)
 {
     return(ItemSearch(index, keywords, page, responseGroups, merchant, maxPrice, minPrice, null));
 }
        public void LoadMerchants()
        {
            Merchants.Add(EfMerchantRepository.CreateMerchant_Amazon());

            Merchants.Add(EfMerchantRepository.CreateMerchant_Apple());
        }
 public Merchant GetMerchant(Guid merchantID)
 {
     return(Merchants.Where(m => m.MerchantID == merchantID).FirstOrDefault());
 }
예제 #12
0
        private ItemSearchRequest RequestBuilder(SearchIndex index, string keywords, int page, IEnumerable<ResponseGroup> responseGroups,
            Merchants merchant, int? maximumPrice, int? minimumPrice, int? percentageOff)
        {
            var request = new ItemSearchRequest
            {
                SearchIndex = index.ToString(),
                Keywords = keywords,
                MaximumPrice = maximumPrice != null ? maximumPrice.ToString() : null,
                MinimumPrice = minimumPrice != null ? minimumPrice.ToString() : null,
                MerchantId = merchant.ToString(),
                MinPercentageOff = percentageOff != null ? percentageOff.ToString() : null,
                ItemPage = page.ToString(CultureInfo.InvariantCulture),
                ResponseGroup = new[] { String.Join(",", responseGroups.Select(i => i.ToString()).ToArray()), }
            };

            return request;
        }
예제 #13
0
        public ItemSearchResponse ItemSearch(SearchIndex index, string keywords, int page, List<ResponseGroup> responseGroups,
            Merchants merchant, int? maxPrice, int? minPrice, int? minPercentageOff)
        {
            var request = RequestBuilder(index, keywords, page, responseGroups, merchant, maxPrice, minPrice, minPercentageOff);
            var itemSearch = SearchRequest(request);

            var response = client.ItemSearch(itemSearch);

            return response;
        }
예제 #14
0
 public ItemSearchResponse ItemSearch(SearchIndex index, string keywords, int page, List<ResponseGroup> responseGroups,
     Merchants merchant, int maxPrice, int minPrice)
 {
     return ItemSearch(index, keywords, page, responseGroups, merchant, maxPrice, minPrice, null);
 }
 public Merchants SignUp(Merchants merchant)
 {
     throw new NotImplementedException();
 }
 public bool CreateWebsitPage(Merchants merchant)
 {
     throw new NotImplementedException();
 }