Example #1
0
        public void Ok_ConvertsOutput_ToJson()
        {
            // valuetypes are serialized as one element value array
            var target = new LaunchPad();
            var result = LaunchPad.Ok("A string");

            AssertEx.AreEqual(HttpStatusCode.OK, result.StatusCode);

            var expectedResult = new ServiceResponse("A string");

            AssertEx.AreEqual(JsonConvert.SerializeObject(expectedResult, Formatting.Indented), result.Content.ReadAsStringAsync().Result);
        }
        public void Ok_ConvertsOutput_ToJson()
        {
            // valuetypes are serialized as one element value array
            var target = new LaunchPad();
            var result = target.Ok("A string");

            AssertEx.AreEqual(HttpStatusCode.OK, result.StatusCode);
            AssertEx.AreEqual(
                @"{
  ""Count"": 1,
  ""ErrorCode"": null,
  ""Values"": [
    ""A string""
  ],
  ""ErrorMessage"": null
}"
                , result.Content.ReadAsStringAsync().Result);
        }