コード例 #1
0
        public void Can_get_keyvaluepair()
        {
            var client = new ServiceStackAutorestClient(new Uri(Constants.AbsoluteBaseUri));

            var result = client.ReturnKeyValuePairRequest.Get();

            Assert.That(result.Key, Is.EqualTo("key1"));
            Assert.That(result.Value, Is.EqualTo("value1"));
        }
        public void Can_Get_Returned_KeyPair()
        {
            using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri)))
            {
                var result = client.ReturnKeyValuePairRequest.Get();

                Assert.That(result.Key, Is.EqualTo("key1"));
                Assert.That(result.Value, Is.EqualTo("value1"));
            }
        }
コード例 #3
0
        public void Can_get_returned_string_dictionary()
        {
            using (var client = new ServiceStackAutorestClient(new Uri(Constants.AbsoluteBaseUri)))
            {
                var result = client.ReturnDictionaryStringRequest.Get();

                Assert.That(result.Count, Is.EqualTo(2));
                Assert.That(result["key1"], Is.EqualTo("value1"));
                Assert.That(result["key2"], Is.EqualTo("value2"));
            }
        }
コード例 #4
0
        public void Can_get_array()
        {
            var client = new ServiceStackAutorestClient(new Uri(Constants.AbsoluteBaseUri));

            var result = client.ReturnArrayRequest.Get();

            Assert.That(result.Count, Is.EqualTo(3));
            Assert.That(result[0].Id, Is.EqualTo(1));
            Assert.That(result[1].Id, Is.EqualTo(2));
            Assert.That(result[2].Id, Is.EqualTo(3));
        }
        public void Can_get_returned_dto_dictionary()
        {
            using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri)))
            {
                var result = client.ReturnDictionaryDtoRequest.Get();

                Assert.That(result.Count, Is.EqualTo(2));
                Assert.That(result["key1"].Id, Is.EqualTo(1));
                Assert.That(result["key2"].Id, Is.EqualTo(2));
            }
        }
        public void Can_get_generic_list()
        {
            var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri));

            var result = client.ReturnListRequest.Get();

            Assert.That(result.Count, Is.EqualTo(3));
            Assert.That(result[0].Id, Is.EqualTo(1));
            Assert.That(result[1].Id, Is.EqualTo(2));
            Assert.That(result[2].Id, Is.EqualTo(3));
        }
コード例 #7
0
        public void Can_get_annotated_service_with_array_enum()
        {
            var client = new ServiceStackAutorestClient(new Uri(Constants.AbsoluteBaseUri));

            var dto = new GetMovie {
                Id = 1, Includes = new[] { "Genres", "Releases" }
            };

            var result = client.GetMovieId.Post(dto.Id, dto.Includes);

            Assert.That(result.Includes, Is.EquivalentTo(dto.Includes));
        }
コード例 #8
0
        public void Can_get_all_types()
        {
            var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri));

            HelloAllTypes helloAllTypes = new HelloAllTypes()
            {
                Name               = "Hello",
                AllTypes           = DtoHelper.GetAllTypes(),
                AllCollectionTypes = DtoHelper.GetAllCollectionTypes()
            };

            var result = client.HelloAllTypes.Get("123", helloAllTypes.AllTypes.ToJsv(), null);
        }
コード例 #9
0
        public void Can_post_all_types()
        {
            var dto = new HelloAllTypes
            {
                Name               = "Hello",
                AllTypes           = DtoHelper.GetAllTypes(),
                AllCollectionTypes = DtoHelper.GetAllCollectionTypes()
            };

            using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri)))
            {
                var result = client.HelloAllTypes.Post("123", null, null, dto);
            }
        }
コード例 #10
0
        public void Can_get_all_types()
        {
            var dto = new HelloAllTypes
            {
                Name               = "Hello",
                AllTypes           = DtoHelper.GetAllTypes(),
                AllCollectionTypes = DtoHelper.GetAllCollectionTypes()
            };

            using (var client = new ServiceStackAutorestClient(new Uri(Constants.AbsoluteBaseUri)))
            {
                var result = client.HelloAllTypes.Get("123", dto.AllTypes.ToJsv(), null);
            }
        }
コード例 #11
0
        public void Can_post_all_types_with_result()
        {
            var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri));

            var dto = new HelloAllTypesWithResult()
            {
                Name               = "Hello",
                AllTypes           = DtoHelper.GetAllTypes(),
                AllCollectionTypes = DtoHelper.GetAllCollectionTypes()
            };

            var result = client.HelloAllTypesWithResult.Post(body: dto);

            Assert.That(result.Result, Is.EqualTo(dto.Name));
            DtoHelper.AssertAllTypes(result.AllTypes, dto.AllTypes);
            DtoHelper.AssertAllCollectionTypes(result.AllCollectionTypes, dto.AllCollectionTypes);
        }
コード例 #12
0
        public void Can_get_all_types_with_result()
        {
            var dto = new HelloAllTypesWithResult
            {
                Name               = "Hello",
                AllTypes           = DtoHelper.GetAllTypes(),
                AllCollectionTypes = DtoHelper.GetAllCollectionTypes()
            };

            using (var client = new ServiceStackAutorestClient(new Uri(Config.AbsoluteBaseUri)))
            {
                var at = dto.AllTypes.ToJsv();

                var result = client.HelloAllTypesWithResult.Get(dto.Name, dto.AllTypes.ToJsv(), dto.AllCollectionTypes.ToJsv());

                Assert.That(result.Result, Is.EqualTo(dto.Name));
                DtoHelper.AssertAllTypes(result.AllTypes, dto.AllTypes);
                DtoHelper.AssertAllCollectionTypes(result.AllCollectionTypes, dto.AllCollectionTypes);
            }
        }