示例#1
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new ActivitiesClient(connection);

                var filters = new ActivityFilters
                {
                    PageSize  = 1,
                    PageCount = 1,
                    StartPage = 0,
                    Done      = ActivityDone.Done,
                };

                await client.GetAll(filters);

                Received.InOrder(async() =>
                {
                    await connection.GetAll <Activity>(
                        Arg.Is <Uri>(u => u.ToString() == "activities"),
                        Arg.Is <Dictionary <string, string> >(d => d.Count == 2 &&
                                                              d["user_id"] == "0" &&
                                                              d["done"] == "1"),
                        Arg.Is <ApiOptions>(o => o.PageSize == 1 &&
                                            o.PageCount == 1 &&
                                            o.StartPage == 0)
                        );
                });
            }
示例#2
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new ActivitiesClient(Substitute.For <IApiConnection>());

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