예제 #1
0
        public void Diffing_Algorithm_Performs_Diff(string left, string right, DiffResult.DiffResultType expected)
        {
            List <DiffEntry> testDiff = new List <DiffEntry>();

            testDiff.Add(new DiffEntry(1, left, right));

            DiffManager.test_Init(testDiff);

            DiffResult result = DiffManager.Compare(1);

            Assert.AreEqual(expected, result.ResultType);
        }
예제 #2
0
        public HttpResponseMessage GetById(int id)
        {
            HttpResponseMessage comparisonResponse = new HttpResponseMessage();

            DiffResult result = DiffManager.Compare(id);

            if (result.Valid == false)
            {
                comparisonResponse.StatusCode = HttpStatusCode.NotFound;

                return(comparisonResponse);
            }

            comparisonResponse.Content = new StringContent(JsonConvert.SerializeObject(result));
            comparisonResponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            comparisonResponse.StatusCode = HttpStatusCode.OK;

            return(comparisonResponse);
        }