예제 #1
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new StagesClient(connection);

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

                await client.GetDeals(123, filters);

                Received.InOrder(async() =>
                {
                    await connection.GetAll <PipelineDeal>(
                        Arg.Is <Uri>(u => u.ToString() == "stages/123/deals"),
                        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)
                        );
                });
            }
예제 #2
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new StagesClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetDeals(1, null));
            }