Exemple #1
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);
        }
        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);
            }
        }