コード例 #1
0
        public void Test1()
        {
            IApiController controller = new IApiController();

            JObject expectedResult = new JObject();

            expectedResult.Add("success", true);
            expectedResult.Add("message", "Lorum ipsum message..");
            expectedResult.Add("data", JsonConvert.SerializeObject(new { test = "hallo" }));

            // ~ Act
            var     response = controller.CreateResponse("Lorum ipsum message..", JsonConvert.SerializeObject(new { test = "hallo" }), true);
            JObject result   = JObject.Parse(Convert.ToString(response.Value));

            // ~ Assert
            Assert.NotNull(result);
            Assert.Equal(expectedResult, result);
        }