コード例 #1
0
        public async Task HydrateMainViewModel()
        {
            string url = string.Empty;

            try
            {
                url = string.Format("{0}/?UserID={1}", API.ProspectsAPI, App.Current.Properties["UserId"]);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }

            var feeds = await API.Get(url);

            foreach (var prospect in feeds.Select(contactFeed => new Prospect
            {
                Name = contactFeed.Value <string>("Name"),
                PicUrl = contactFeed.Value <string>("PicUrl"),
                ProspectID = contactFeed.Value <int>("ProspectID"),
                Status = contactFeed.Value <byte>("Status"),
                UserID = contactFeed.Value <byte>("UserID")
            }))
            {
                Prospects.Add(prospect);
            }
        }
コード例 #2
0
        public void ProspectsSearchForProspectsRequestIsFormedCorrectly()
        {
            var mockDataSource = MockRepository.GenerateMock <IWebClient>();
            var expectedUrl    = Constants.SearchForProspectsUrl;

            // Arrange
            mockDataSource
            .Stub(x => x.UploadString(
                      Arg <string> .Is.Anything, // uri
                      Arg <string> .Is.Anything, // method
                      Arg <string> .Is.Anything, // content-type
                      Arg <string> .Is.Anything  // data
                      ))
            .Return(string.Empty);


            // Act
            var target = new Prospects(accessToken: Constants.AccessToken)
            {
                UserWebClient = mockDataSource
            };

            target.SearchForProspects("city", "Cambridge");


            // Assert
            mockDataSource.AssertWasCalled(c => c.UploadString(
                                               Arg <string> .Matches(actualUrl => actualUrl == expectedUrl),
                                               Arg <string> .Is.Anything,
                                               Arg <string> .Is.Anything,
                                               Arg <string> .Is.Anything));
        }
コード例 #3
0
        void ProspectUnHideAProspectUrlFormedCorrectly()
        {
            var          mockDataSource = MockRepository.GenerateMock <IWebClient>();
            const string data           = "";
            string       expectedUrl    = Constants.UnHideAProspectUrl;

            // Arrange
            mockDataSource
            .Stub(x => x.UploadString(
                      Arg <string> .Is.Anything, // uri
                      Arg <string> .Is.Anything, // method
                      Arg <string> .Is.Anything, // content-type
                      Arg <string> .Is.Anything  // data
                      ))
            .Return(data);

            // Act
            var target = new Prospects(accessToken: Constants.AccessToken)
            {
                UserWebClient = mockDataSource
            };

            target.UnHideAProspect(Constants.ProspectOrganization);

            // Assert
            mockDataSource.AssertWasCalled(c => c.UploadString(
                                               Arg <string> .Matches(actualUrl => actualUrl == expectedUrl),
                                               Arg <string> .Is.Anything,
                                               Arg <string> .Is.Anything,
                                               Arg <string> .Is.Anything));
        }
コード例 #4
0
        public void ProspectGetProspectsWithOffsetUrlFormedCorrectly()
        {
            var mockDataSource = MockRepository.GenerateMock <IWebClient>();
            var expectedUrl    = Constants.GetProspectWithTimeOffsetUrl;

            // Arrange
            mockDataSource
            .Stub(x => x.UploadString(
                      Arg <string> .Is.Anything, // uri
                      Arg <string> .Is.Anything, // method
                      Arg <string> .Is.Anything, // content-type
                      Arg <string> .Is.Anything  // data
                      ))
            .Return(string.Empty);

            // Act
            var target = new Prospects(accessToken: Constants.AccessToken)
            {
                UserWebClient = mockDataSource
            };

            target.GetProspects(timeOffset: Constants.TimeOffset, orgOffset: Constants.OrgOffset);

            // Assert
            mockDataSource.AssertWasCalled(c => c.UploadString(
                                               Arg <string> .Matches(actualUrl => actualUrl == expectedUrl),
                                               Arg <string> .Is.Anything,
                                               Arg <string> .Is.Anything,
                                               Arg <string> .Is.Anything));
        }
コード例 #5
0
        void ProspectsHideAProspectRequestIsFormedCorrectly()
        {
            var          mockDataSource = MockRepository.GenerateMock <IWebClient>();
            const string data           = "";
            var          expectedUrl    = Constants.UnHideAProspectUrl;


            // Arrange
            mockDataSource
            .Stub(x => x.UploadString(
                      Arg <string> .Is.Anything, // uri
                      Arg <string> .Is.Anything, // method
                      Arg <string> .Is.Anything, // content-type
                      Arg <string> .Is.Anything  // data
                      ))
            .Return(data);

            // Act
            var target = new Prospects(accessToken: Constants.AccessToken)
            {
                UserWebClient = mockDataSource
            };

            target.HideAProspect(Encoder.UrlEncode(Constants.ProspectOrganization));

            // Assert
            mockDataSource.AssertWasCalled(c => c.UploadString(
                                               Arg <string> .Matches(actualUrl => actualUrl == expectedUrl),
                                               Arg <string> .Matches(actualMethod => actualMethod == "POST"),
                                               Arg <string> .Matches(actualContentType => actualContentType == "application/x-www-form-urlencoded"),
                                               Arg <string> .Matches(actaulData => actaulData == "marriott%20hotel")));
        }
コード例 #6
0
ファイル: Jobcentre.cs プロジェクト: chaojikugua/CapitalCity
    public override void ReceiveImmigrant(Prole prospect)
    {
        prospect.StartWaitCountdown();
        Prospects.Add(prospect);
        ProspectsExpecting--;

        //if we traverse the whole array without there being an empty space
        if (Prospects.Count > maxProspects)
        {
            Debug.LogError(name + " received an immigrant when it didn't need one");
        }
    }
コード例 #7
0
        public void ProspectUpdated(Prospect prospect)
        {
            Analytics.TrackEvent("Prospect Updated", new Dictionary <string, string>
            {
                { "Community", prospect.ProspectCommunity.CommunityNumber + " " + prospect.ProspectCommunity.Community.Description },
                { "SalesAssociate", prospect.ProspectCommunity.SalespersonAddressNumber + " " + prospect.ProspectCommunity.SalespersonName },
                { "User", _user.AddressBook.AddressNumber + " " + _user.AddressBook.Name },
            });
            var request = new TableRow {
                TableRowToUpdate = Prospects.IndexOf(prospect)
            };

            _updateRowInteraction.Raise(request);
        }
コード例 #8
0
ファイル: HttpCalls.cs プロジェクト: cusanelly/localb
        public async Task <IEnumerable <Ad_List> > BuyOnline(int max = 10)
        {
            var client = new HttpClient();

            var response = (String.IsNullOrEmpty(Next)) ?
                           await client.GetStringAsync(Url + "/usd/.json?fields=profile,location_string,temp_price,bank_name,msg") :
                           await client.GetStringAsync(Next);

            var obj = JsonConvert.DeserializeObject <Rootobject>(response);

            #region FILTER KEYWORD
            // Filtramos los resultados
            IEnumerable <Ad_List> result = obj.data.ad_list.Where(t =>
                                                                  t.data.bank_name.ToLower().Contains("banesco") ||
                                                                  t.data.msg.ToLower().Contains("banesco") ||
                                                                  t.data.bank_name.ToLower().Contains("banesco panama") ||
                                                                  t.data.msg.ToLower().Contains("banesco panama") ||
                                                                  t.data.bank_name.ToLower().Contains("bofa") ||
                                                                  t.data.msg.ToLower().Contains("bofa") ||
                                                                  t.data.bank_name.ToLower().Contains("zelle") ||
                                                                  t.data.msg.ToLower().Contains("zelle") ||
                                                                  t.data.bank_name.ToLower().Contains("bank of america") ||
                                                                  t.data.msg.ToLower().Contains("bank of america") ||
                                                                  t.data.bank_name.ToLower().Contains("boa") ||
                                                                  t.data.msg.ToLower().Contains("boa")
                                                                  ).Select(t => t);
            #endregion


            Next = obj.pagination.next;
            if (result.Count() > 0)
            {
                Prospects.AddRange(result);
            }
            if (Prospects.Count < max)
            {
                await BuyOnline(max : max);
            }

            return(Prospects);
        }
コード例 #9
0
 public void ActivityAdded(Activity activity)
 {
     try
     {
         if (activity.ActivityType.Equals("VISIT") || activity.ActivityType.Equals("APPOINTMENT"))
         {
             var prospect = Prospects.FirstOrDefault(p => p.ProspectAddressNumber == activity.ProspectAddressNumber);
             if (prospect != null)
             {
                 prospect.ProspectCommunity.SystemActivityDate = (DateTime)activity.DateCompleted;
                 var request = new TableRow {
                     TableRowToUpdate = Prospects.IndexOf(prospect)
                 };
                 _updateRowInteraction.Raise(request);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #10
0
ファイル: Jobcentre.cs プロジェクト: chaojikugua/CapitalCity
 void RemoveProspectFromArray(Prole prospect)
 {
     Prospects.Remove(prospect);
 }
コード例 #11
0
        public void ProspectGetProspectsWithTimeOffsetOnlyShouldFail()
        {
            var expect = new Prospects(accessToken: Constants.AccessToken);

            expect.GetProspects(timeOffset: Constants.TimeOffset);
        }
コード例 #12
0
        public void ProspectsClassInitializes()
        {
            var target = new Prospects(apiKey: Constants.ApiKey);

            Assert.IsNotNull(target);
        }