コード例 #1
0
        public async void Get_WithEmptyArray_ShouldSucceedAndReturnEmptySet()
        {
            // ARRANGE
            var httpClient = HttpClientStub.Create(c =>
            {
                c.ForPath(ApiTestPath)
                .ReturnJsonFor(new object[] { });
            });
            var sut = new JsonApiClient(httpClient);

            // ACT
            var result = await sut.Get <IEnumerable <int> >(ApiTestPath);

            // ASSERT
            result.ShouldBeEmpty();
        }
コード例 #2
0
        public async void Get_WithIntegerArray_ShouldSucceedAndReturnIntegerArray()
        {
            // ARRANGE
            var integerSet = CreateIntegerSet();
            var httpClient = HttpClientStub.Create(c =>
            {
                c.ForPath(ApiTestPath)
                .ReturnJsonFor(integerSet);
            });
            var sut = new JsonApiClient(httpClient);

            // ACT
            var result = await sut.Get <IEnumerable <int> >(ApiTestPath);

            // ASSERT
            result.ShouldBe(integerSet);
        }