forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServiceSetupTests.cs
More file actions
62 lines (54 loc) · 1.51 KB
/
Copy pathServiceSetupTests.cs
File metadata and controls
62 lines (54 loc) · 1.51 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using Funq;
using NUnit.Framework;
namespace ServiceStack.WebHost.Endpoints.Tests
{
public class ServiceSetup : IReturn<ServiceSetup>
{
public int Id { get; set; }
}
public class BaseService<T> : Service
{
public virtual object Get(T dto)
{
return null;
}
}
public class Actual : BaseService<ServiceSetup>
{
public override object Get(ServiceSetup dto)
{
dto.Id++;
return dto;
}
}
public class ServiceSetupAppHost : AppHostHttpListenerBase
{
public ServiceSetupAppHost() : base("Service Setup Tests", typeof(Actual).Assembly) { }
public override void Configure(Container container) { }
}
[TestFixture]
public class ServiceSetupTests
{
private const string BaseUri = "http://localhost:8000/";
JsonServiceClient client = new JsonServiceClient(BaseUri);
private ServiceSetupAppHost appHost;
[TestFixtureSetUp]
public void TestFixtureSetUp()
{
appHost = new ServiceSetupAppHost();
appHost.Init();
appHost.Start(BaseUri);
}
[TestFixtureTearDown]
public void TestFixtureTearDown()
{
appHost.Dispose();
}
[Test]
public void Can_still_load_with_Abstract_Generic_BaseTypes()
{
var response = client.Get(new ServiceSetup { Id = 1 });
Assert.That(response.Id, Is.EqualTo(2));
}
}
}