Ejemplo n.º 1
0
            public async Task OrderByAddsTheParameterFromBaseType()
            {
                // arrange
                var httpConnection = Substitute.For <IHttpConnection>();

                httpConnection
                .FilterAsync <BiggerTestModel>(Arg.Any <Uri>(), Arg.Any <Dictionary <string, object> >())
                .Returns(Task.FromResult(new CollectionResult <BiggerTestModel> {
                    Results = Array.Empty <BiggerTestModel>()
                }));
                var apiConnection = new ApiConnection(httpConnection);
                var client        = new TestClient(apiConnection);

                // act
                var model = await client.BiggerFilter()
                            .OrderBy(x => x.LastName)
                            .FirstOrDefaultAsync();

                // assert
                _ = httpConnection.Received().FilterAsync <BiggerTestModel>(
                    Arg.Any <Uri>(),
                    Arg.Is <Dictionary <string, object> >(o => o["sort"].Equals("last_name:asc")));
            }