Example #1
0
        public void Get_TestObjectCount_GeneratesCorrectUrl()
        {
            const int expected = 13;

            _mockHttpService
            .Expect(x => x.Get <int>(new Uri("http://localhost:6789/api/TestObject/?$format=json&$count")))
            .Return(expected);

            var resource = _endpoint.GetResource <TestObject>();

            var count = resource.Get().Count();

            Assert.That(count, Is.EqualTo(expected));

            _mockHttpService.VerifyAllExpectations();
        }
Example #2
0
 private static void SetExpectation <T>(IHttpService httpService, Uri expectedUri, IEnumerable <T> result)
 {
     httpService
     .Expect(x => x.Get <IEnumerable <T> >(expectedUri))
     .Return(result);
 }