public void TestThatResourcesBuildFluently() { var resources = Resources .Are(ConfigurationResource <UserResource> .Defining("user", typeof(UserResource), 10, Actions.CanBe("POST", "/users", "register(body:Vlingo.Http.Tests.Sample.User.UserData userData)") .Also("PATCH", "/users/{userId}/contact", "changeContact(string userId, body:Vlingo.Http.Tests.Sample.User.ContactData contactData)") .Also("PATCH", "/users/{userId}/name", "changeName(string userId, body:Vlingo.Http.Tests.Sample.User.NameData nameData)") .Also("GET", "/users/{userId}", "queryUser(string userId)") .Also("GET", "/users", "queryUsers()") .ThatsAll()), ConfigurationResource <ProfileResource> .Defining("profile", typeof(ProfileResource), 5, Actions.CanBe("PUT", "/users/{userId}/profile", "define(string userId, body:Vlingo.Http.Tests.Sample.User.ProfileData profileData)", "Vlingo.Http.Tests.Sample.User.ProfileDataMapper") .Also("GET", "/users/{userId}/profile", "query(string userId)", "Vlingo.Http.Tests.Sample.User.ProfileDataMapper") .ThatsAll())); Assert.NotNull(resources.ResourceOf("user")); Assert.NotNull(resources.ResourceOf("profile")); }
public void TestThatServerStartsWithFilters() { var world = World.StartWithDefaults("filters"); var resource = ConfigurationResource.Defining("profile", typeof(ProfileResource), 5, Actions.CanBe("PUT", "/users/{userId}/profile", "define(string userId, body:Vlingo.Http.Tests.Sample.User.ProfileData profileData)", "Vlingo.Http.Tests.Sample.User.ProfileDataMapper") .Also("GET", "/users/{userId}/profile", "query(string userId)", "Vlingo.Http.Tests.Sample.User.ProfileDataMapper").ThatsAll(), world.DefaultLogger); var server = ServerFactory.StartWith( world.Stage, Resources.Are(resource), Filters.Are(new [] { new RequestFilter1() }, Filters.NoResponseFilters()), 8081, Configuration.SizingConf.DefineConf(), Configuration.TimingConf.DefineConf()); Assert.NotNull(server); }