My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using NUnit.Framework;
using ServiceStack.Common.Utils;
using ServiceStack.ServiceClient.Web;
using ServiceStack.UsageExamples.Support;

namespace ServiceStack.UsageExamples
{
/// <summary>
/// Examples using the generated dto from the xsd
/// </summary>
[TestFixture]
public class UsingDtoFromXsd : TestBase
{
[Test]
public void Get_customers_using_dto_from_xsd_and_deserialize()
{
using (var client = new Soap12ServiceClient(base.WsSyncReplyUri))
{
var request = new xsd.GetCustomers { Version = 100, CustomerIds = new xsd.ArrayOfIntId { CustomerId } };
var response = client.Send(request);
var customersResponse = response.GetBody<xsd.GetCustomersResponse>();
Assert.AreEqual(1, customersResponse.Customers.Length);
Assert.AreEqual(CustomerId, customersResponse.Customers[0].Id);
}
}

[Test]
public void Get_customers_using_dto_from_xsd_and_deserialize_BasicHttp()
{
using (var client = new Soap11ServiceClient(base.BasicHttpSyncReplyUri))
{
var request = new xsd.GetCustomers { Version = 100, CustomerIds = new xsd.ArrayOfIntId { CustomerId } };
var response = client.Send(request);
var customersResponse = response.GetBody<xsd.GetCustomersResponse>();
Assert.AreEqual(1, customersResponse.Customers.Length);
Assert.AreEqual(CustomerId, customersResponse.Customers[0].Id);
}
}

}
}

Change log

r398 by demis.bellot on Oct 14, 2009   Diff
re add UsageExamples
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1406 bytes, 41 lines
Powered by Google Project Hosting