public static EchoModel CreateEcho() { EchoModel model = new EchoModel(); Console.WriteLine("Input echo msg to server: "); model.Message = Console.ReadLine(); return(model); }
public void Should_be_able_to_send_json_in_body() { // Given var model = new EchoModel { SomeString = "Some String", SomeInt = 29, SomeBoolean = true }; // When var result = browser.Post("/", with => { with.JsonBody(model); }); // Then var actualModel = result.Body.DeserializeJson<EchoModel>(); actualModel.ShouldNotBeNull(); actualModel.SomeString.ShouldEqual(model.SomeString); actualModel.SomeInt.ShouldEqual(model.SomeInt); actualModel.SomeBoolean.ShouldEqual(model.SomeBoolean); }
public async Task Should_be_able_to_send_xml_in_body() { // Given var model = new EchoModel { SomeString = "Some String", SomeInt = 29, SomeBoolean = true }; // When var result = await browser.Post("/", with => { with.XMLBody(model); }); // Then var actualModel = result.Body.DeserializeXml <EchoModel>(); actualModel.ShouldNotBeNull(); actualModel.SomeString.ShouldEqual(model.SomeString); actualModel.SomeInt.ShouldEqual(model.SomeInt); actualModel.SomeBoolean.ShouldEqual(model.SomeBoolean); }
public void Should_be_able_to_send_xml_in_body() { // Given var model = new EchoModel { SomeString = "Some String", SomeInt = 29, SomeBoolean = true }; // When var result = browser.Post("/", with => { with.XMLBody(model); }); // Then var actualModel = result.Body.DeserializeXml<EchoModel>(); actualModel.ShouldNotBeNull(); actualModel.SomeString.ShouldEqual(model.SomeString); actualModel.SomeInt.ShouldEqual(model.SomeInt); actualModel.SomeBoolean.ShouldEqual(model.SomeBoolean); }
public string Echo([FromBody] EchoModel echoModel) { return($"ECHO: {echoModel.EchoText}"); }
public async Task Should_be_able_to_send_json_in_body() { // Given var model = new EchoModel { SomeString = "Some String", SomeInt = 29, SomeBoolean = true }; // When var result = await browser.Post("/", with => { with.JsonBody(model); }); // Then var actualModel = result.Body.DeserializeJson<EchoModel>(); actualModel.ShouldNotBeNull(); actualModel.SomeString.ShouldEqual(model.SomeString); actualModel.SomeInt.ShouldEqual(model.SomeInt); actualModel.SomeBoolean.ShouldEqual(model.SomeBoolean); }