Esempio n. 1
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new OrganizationsClient(connection);

                var filters = new OrganizationUpdateFilters
                {
                    PageSize  = 1,
                    PageCount = 1,
                    StartPage = 0,
                };

                await client.GetUpdates(123, filters);

                Received.InOrder(async() =>
                {
                    await connection.GetAll <DealUpdateFlow>(
                        Arg.Is <Uri>(u => u.ToString() == "organizations/123/flow"),
                        Arg.Is <Dictionary <string, string> >(d => d.Count == 1 &&
                                                              d["id"] == "123"),
                        Arg.Is <ApiOptions>(o => o.PageSize == 1 &&
                                            o.PageCount == 1 &&
                                            o.StartPage == 0));
                });
            }
Esempio n. 2
0
            public async Task ReturnsCorrectCountWithoutStart()
            {
                var pipedrive = Helper.GetAuthenticatedClient();

                var options = new OrganizationUpdateFilters
                {
                    PageSize  = 3,
                    PageCount = 1
                };

                var organizationUpdates = await pipedrive.Organization.GetUpdates(5, options);

                Assert.Equal(3, organizationUpdates.Count);
            }
Esempio n. 3
0
            public async Task ReturnsDistinctInfosBasedOnStartPage()
            {
                var pipedrive = Helper.GetAuthenticatedClient();

                var startOptions = new OrganizationUpdateFilters
                {
                    PageSize  = 1,
                    PageCount = 1
                };

                var firstPage = await pipedrive.Organization.GetUpdates(5, startOptions);

                var skipStartOptions = new OrganizationUpdateFilters
                {
                    PageSize  = 1,
                    PageCount = 1,
                    StartPage = 1
                };

                var secondPage = await pipedrive.Organization.GetUpdates(5, skipStartOptions);

                Assert.NotEqual(firstPage[0].Data.Id, secondPage[0].Data.Id);
            }