Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Integration test for OpenRasta
public void Should_Add_User()
var user = new UserInput {Email = "", FirstName = "automated", LastName = "user", Password = "abc"};
using (var host = new InMemoryHost(new Configuration()))
var req = new InMemoryRequest
Uri = new Uri("http://localhost/users"),
HttpMethod = "POST"
req.Entity.ContentType = MediaType.Json;
req.Entity.Headers["Accept"] = "application/json";
var serializer = new DataContractJsonSerializer(typeof(UserInput));
serializer.WriteObject(req.Entity.Stream, user);
req.Entity.Stream.Seek(0, SeekOrigin.Begin);
req.Entity.ContentLength = req.Entity.Stream.Length;
var response = host.ProcessRequest(req);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment