Пример #1
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new NotesClient(connection);

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

                await client.GetAll(filters);

                Received.InOrder(async() =>
                {
                    await connection.GetAll <Note>(
                        Arg.Is <Uri>(u => u.ToString() == "notes"),
                        Arg.Is <Dictionary <string, string> >(d => d.Count == 0),
                        Arg.Is <ApiOptions>(o => o.PageSize == 1 &&
                                            o.PageCount == 1 &&
                                            o.StartPage == 0)
                        );
                });
            }
Пример #2
0
            public async Task ReturnsCorrectCountWithoutStart()
            {
                var pipedrive = Helper.GetAuthenticatedClient();

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

                var notes = await pipedrive.Note.GetAll(options);

                Assert.Equal(3, notes.Count);
            }
Пример #3
0
            public async Task ReturnsDistinctInfosBasedOnStartPage()
            {
                var pipedrive = Helper.GetAuthenticatedClient();

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

                var firstPage = await pipedrive.Note.GetAll(startOptions);

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

                var secondPage = await pipedrive.Note.GetAll(skipStartOptions);

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