public void Accept_A_Complex_Type_As_Input() { using( var server = NanoTestServer.Start() ) { // Arrange server.NanoConfiguration.AddMethods<Echo>(); var complexType = new Echo.ComplexType { Id = 654, Name = "Some Name" }; string complexTypeJson = JsonConvert.SerializeObject( complexType ); // Act var response = HttpHelper.GetResponseString( server.GetUrl() + "/api/Echo/EchoComplexType?someComplexType=" + complexTypeJson ); // Visual Assertion Trace.WriteLine( response ); // Assert Assert.That( response.Contains( complexTypeJson ) ); } }
public void Serialize_Returned_Objects_Into_Json_By_Default() { using( var server = NanoTestServer.Start() ) { // Arrange server.NanoConfiguration.AddMethods<Echo>(); var complexType = new Echo.ComplexType { Id = 456, Name = "Some Name" }; var complexTypeJson = JsonConvert.SerializeObject( complexType ); // Act var response = HttpHelper.GetResponseString( server.GetUrl() + "/api/Echo/EchoComplexType?someComplexType=" + complexTypeJson ); // Visual Assertion Trace.WriteLine( response ); // Assert Assert.That( response.Contains( "{" ) && response.Contains( "}" ) ); } }