Beispiel #1
0
 public void SetUp()
 {
     _odataClientMock      = new Mock <IODataClient>();
     _duplicateServiceMock = new Mock <IDuplicateDetectionService>();
     _loggerMock           = new Mock <ILogger <SearchRequestService> >();
     _sut = new SearchRequestService(_odataClientMock.Object, _duplicateServiceMock.Object, _loggerMock.Object);
 }
        public void SetUp()
        {
            _odataClientMock      = new Mock <IODataClient>();
            _duplicateServiceMock = new Mock <IDuplicateDetectionService>();
            _loggerMock           = new Mock <ILogger <SearchRequestService> >();

            _odataClientMock.Setup(x => x.For <SSG_Country>(null)
                                   .Filter(It.IsAny <Expression <Func <SSG_Country, bool> > >())
                                   .FindEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <SSG_Country>(new SSG_Country()
            {
                CountryId = Guid.NewGuid(),
                Name      = "Canada"
            }));

            _odataClientMock.Setup(x => x.For <SSG_CountrySubdivision>(null)
                                   .Filter(It.IsAny <Expression <Func <SSG_CountrySubdivision, bool> > >())
                                   .FindEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <SSG_CountrySubdivision>(new SSG_CountrySubdivision()
            {
                CountrySubdivisionId = Guid.NewGuid(),
                Name = "British Columbia"
            }));

            _sut = new SearchRequestService(_odataClientMock.Object, _duplicateServiceMock.Object, _loggerMock.Object);
        }
Beispiel #3
0
        public void SetUp()
        {
            _odataClientMock      = new Mock <IODataClient>();
            _duplicateServiceMock = new Mock <IDuplicateDetectionService>();
            _loggerMock           = new Mock <ILogger <SearchRequestService> >();
            _sut = new SearchRequestService(_odataClientMock.Object, _duplicateServiceMock.Object, _loggerMock.Object);
            _odataClientMock.Setup(x => x.For <SSG_Country>(null)
                                   .Filter(It.IsAny <Expression <Func <SSG_Country, bool> > >())
                                   .FindEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <SSG_Country>(new SSG_Country()
            {
                CountryId = Guid.NewGuid(),
                Name      = "Canada"
            }));

            _odataClientMock.Setup(x => x.For <SSG_CountrySubdivision>(null)
                                   .Filter(It.IsAny <Expression <Func <SSG_CountrySubdivision, bool> > >())
                                   .FindEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <SSG_CountrySubdivision>(new SSG_CountrySubdivision()
            {
                CountrySubdivisionId = Guid.NewGuid(),
                Name = "British Columbia"
            }));

            _odataClientMock.Setup(x => x.For <SSG_Asset_WorkSafeBcClaim>(null)
                                   .Set(It.IsAny <CompensationClaimEntity>())
                                   .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Asset_WorkSafeBcClaim()
            {
                CompensationClaimId = _testCompensationId
            })
                     );

            _odataClientMock.Setup(x => x.For <SSG_Asset_BankingInformation>(null)
                                   .Set(It.IsAny <BankingInformationEntity>())
                                   .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Asset_BankingInformation()
            {
                BankingInformationId = _testBankInfoId
            })
                     );

            _odataClientMock.Setup(x => x.For <SSG_Employment>(null)
                                   .Set(It.IsAny <EmploymentEntity>())
                                   .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Employment()
            {
                EmploymentId = _testEmployId
            })
                     );

            _odataClientMock.Setup(x => x.For <SSG_EmploymentContact>(null)
                                   .Set(It.IsAny <EmploymentContactEntity>())
                                   .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_EmploymentContact()
            {
                PhoneNumber = "123"
            })
                     );
        }
		public void FetchListTest()
		{
			SearchRequestService service = new SearchRequestService();

			ItemSearchCriteriaTestHelper criteriaTestHelper = new ItemSearchCriteriaTestHelper();

			ItemSearchCriteria criteria = criteriaTestHelper.GetTestEntity();

			IEnumerable<AmazonItem> list = service.FetchList(criteria);

			Assert.IsNotNull(list);
		}
        public void SetUp()
        {
            odataClientMock = new Mock <IODataClient>();

            odataClientMock.Setup(x => x.For <SSG_Identifier>(null).Set(It.Is <SSG_Identifier>(x => x.Identification == "identificationtest"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Identifier()
            {
                Identification = "test"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Country>(null)
                                  .Filter(It.IsAny <Expression <Func <SSG_Country, bool> > >())
                                  .FindEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <SSG_Country>(new SSG_Country()
            {
                CountryId = Guid.NewGuid(),
                Name      = "Canada"
            }));

            odataClientMock.Setup(x => x.For <SSG_Address>(null).Set(It.Is <SSG_Address>(x => x.FullText == "address full text"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Address()
            {
                FullText = "test"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_PhoneNumber>(null).Set(It.Is <SSG_PhoneNumber>(x => x.TelePhoneNumber == "4007678231"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_PhoneNumber()
            {
                TelePhoneNumber = "4007678231"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Aliase>(null).Set(It.Is <SSG_Aliase>(x => x.FirstName == "firstName"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Aliase()
            {
                FullName = "firstName middleName lastName"
            })
                     );

            _sut = new SearchRequestService(odataClientMock.Object);
        }
Beispiel #6
0
        public void SetUp()
        {
            odataClientMock       = new Mock <IODataClient>();
            _duplicateServiceMock = new Mock <IDuplicateDetectionService>();

            odataClientMock.Setup(x => x.For <SSG_SearchRequestResultTransaction>(null).Set(It.IsAny <SSG_SearchRequestResultTransaction>())
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_SearchRequestResultTransaction()
            {
                SourceIdentifier = new SSG_Identifier()
                {
                    Identification = "11111"
                }
            })
                     );

            _sut = new SearchRequestService(odataClientMock.Object, _duplicateServiceMock.Object);
        }
Beispiel #7
0
		static void Main()
		{
			SearchRequestService request = new SearchRequestService();

			ItemSearchCriteria criteria1 = new ItemSearchCriteria
			{
				SearchIndexLookupId = (int)SearchIndexLookupId.SportingGoods,
				ResponseTypeLookupId = new List<int>
				{
					(int)ResponseTypeLookupId.Large
				},
				Keywords = new List<string>
				{
					"Pearl"
				},
				
			};

			ItemSearchCriteria criteria2 = new ItemSearchCriteria
			{
				SearchIndexLookupId = (int)SearchIndexLookupId.Video,
				ResponseTypeLookupId = new List<int>
				{
					(int)ResponseTypeLookupId.Large
				},
				Keywords = new List<string>
				{
					"Star Wars"
				},

			};

			ItemSearchCriteria criteria3 = new ItemSearchCriteria
			{
				SearchIndexLookupId = (int)SearchIndexLookupId.Tools,
				ResponseTypeLookupId = new List<int>
				{
					(int)ResponseTypeLookupId.Large
				},
				Keywords = new List<string>
				{
					"Hide-a-Spare-Key Fake Rock "
				},

			};

			IEnumerable<AmazonItem> list = request.FetchList(criteria2);

			foreach (AmazonItem item in list)
			{
				Console.WriteLine("Title: " + item.Title);
				Console.WriteLine("Price: " + item.Price);
				//string test = item.DetailPageURL;
				//Price test2 = item.ItemAttributes.ListPrice;

				Console.Write(Environment.NewLine);
			}

			Console.WriteLine(Environment.NewLine + "done...enter any key to continue>");

			Console.ReadKey();
		}
Beispiel #8
0
 public void SetUp()
 {
     _odataClientMock = new Mock <IODataClient>();
     _sut             = new SearchRequestService(_odataClientMock.Object, null);
 }
Beispiel #9
0
        public void SetUp()
        {
            odataClientMock = new Mock <IODataClient>();

            odataClientMock.Setup(x => x.For <SSG_Identifier>(null).Set(It.Is <SSG_Identifier>(x => x.Identification == "identificationtest"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Identifier()
            {
                Identification = "test"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Country>(null)
                                  .Filter(It.IsAny <Expression <Func <SSG_Country, bool> > >())
                                  .FindEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <SSG_Country>(new SSG_Country()
            {
                CountryId = Guid.NewGuid(),
                Name      = "Canada"
            }));

            odataClientMock.Setup(x => x.For <SSG_CountrySubdivision>(null)
                                  .Filter(It.IsAny <Expression <Func <SSG_CountrySubdivision, bool> > >())
                                  .FindEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <SSG_CountrySubdivision>(new SSG_CountrySubdivision()
            {
                CountrySubdivisionId = Guid.NewGuid(),
                Name = "British Columbia"
            }));

            odataClientMock.Setup(x => x.For <SSG_Address>(null).Set(It.Is <SSG_Address>(x => x.AddressLine1 == "address full text"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Address()
            {
                AddressLine1 = "test"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_PhoneNumber>(null).Set(It.Is <SSG_PhoneNumber>(x => x.TelePhoneNumber == "4007678231"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_PhoneNumber()
            {
                TelePhoneNumber = "4007678231"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Aliase>(null).Set(It.Is <SSG_Aliase>(x => x.FirstName == "firstName"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Aliase()
            {
                FirstName = "firstName"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Person>(null).Set(It.Is <PersonEntity>(x => x.FirstName == "First"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Person()
            {
                FirstName = "FirstName",
                PersonId  = testPersonId
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Identity>(null).Set(It.Is <SSG_Identity>(x => x.FirstName == "First"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Identity()
            {
                FirstName = "FirstName"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Employment>(null).Set(It.Is <EmploymentEntity>(x => x.BusinessOwner == "Business Owner"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Employment()
            {
                BusinessOwner = "Business Owner"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_EmploymentContact>(null).Set(It.Is <SSG_EmploymentContact>(x => x.PhoneNumber == "12345678"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_EmploymentContact()
            {
                PhoneNumber = "12345678"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Asset_BankingInformation>(null).Set(It.Is <SSG_Asset_BankingInformation>(x => x.BankName == "bank"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Asset_BankingInformation()
            {
                BankName = "bank",
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Asset_Vehicle>(null).Set(It.Is <VehicleEntity>(x => x.PlateNumber == "AAA.BBB"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Asset_Vehicle()
            {
                VehicleId = testVehicleId
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_AssetOwner>(null).Set(It.Is <SSG_AssetOwner>(x => x.FirstName == "firstName"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_AssetOwner()
            {
                FirstName = "firstName"
            })
                     );

            odataClientMock.Setup(x => x.For <SSG_Asset_Other>(null).Set(It.Is <AssetOtherEntity>(x => x.AssetDescription == "asset description"))
                                  .InsertEntryAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new SSG_Asset_Other()
            {
                AssetOtherId = testAssetOtherId
            })
                     );

            _sut = new SearchRequestService(odataClientMock.Object);
        }