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

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

                await client.GetAll(filters);

                Received.InOrder(async() =>
                {
                    await connection.GetAll <File>(
                        Arg.Is <Uri>(u => u.ToString() == "files"),
                        Arg.Is <Dictionary <string, string> >(d => d.Count == 0),
                        Arg.Is <ApiOptions>(o => o.PageSize == 1 &&
                                            o.PageCount == 1 &&
                                            o.StartPage == 0)
                        );
                });
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new FilesClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(null));
            }