Beispiel #1
0
        public void CanDeserializeCMObjectFetchResponse()
        {
            using (Stream data = new MemoryStream(Encoding.UTF8.GetBytes(cmObjectFetchResponse)))
            {
                CMObjectFetchResponse <CMOBjectMock> response =
                    new CMObjectFetchResponse <CMOBjectMock>(new CMResponse(HttpStatusCode.Accepted, data));

                Assert.AreEqual(response.Status, HttpStatusCode.Accepted);
                Assert.AreEqual(response.HasErrors, true);
                Assert.AreEqual(response.Errors.Count, 1);
            };
        }
        public void CanDeserializeCMObjectResponseWithACL()
        {
            using (Stream data = new MemoryStream(Encoding.UTF8.GetBytes(cmObjectResponseWithACL)))
            {
                CMObjectFetchResponse<CMOBjectMock> response =
                    new CMObjectFetchResponse<CMOBjectMock>(new CMResponse(HttpStatusCode.Accepted, data));

                Assert.AreEqual(response.Success["key2"].AccessListIDs.Length, 2);
                Assert.AreEqual(response.Success["key2"].AccessListIDs[0], "2343234aswefwae");
                Assert.AreEqual(response.Success["key2"].AccessListIDs[1], "waef23rf2w38fh");
                Assert.AreEqual(response.Success["key1"].AccessListIDs, null);
                Assert.AreEqual(response.Status, HttpStatusCode.Accepted);
                Assert.AreEqual(response.HasErrors, true);
                Assert.AreEqual(response.Errors.Count, 1);
            };
        }
        public void CanDeserializeCMObjectResponseWithACL()
        {
            using (Stream data = new MemoryStream(Encoding.UTF8.GetBytes(cmObjectResponseWithACL)))
            {
                CMObjectFetchResponse <CMOBjectMock> response =
                    new CMObjectFetchResponse <CMOBjectMock>(new CMResponse(HttpStatusCode.Accepted, data));

                Assert.AreEqual(response.Success["key2"].AccessListIDs.Length, 2);
                Assert.AreEqual(response.Success["key2"].AccessListIDs[0], "2343234aswefwae");
                Assert.AreEqual(response.Success["key2"].AccessListIDs[1], "waef23rf2w38fh");
                Assert.AreEqual(response.Success["key1"].AccessListIDs, null);
                Assert.AreEqual(response.Status, HttpStatusCode.Accepted);
                Assert.AreEqual(response.HasErrors, true);
                Assert.AreEqual(response.Errors.Count, 1);
            };
        }
        public void CanDeserializeCMObjectUnauthorizedResponse()
        {
            using (Stream data = new MemoryStream(Encoding.UTF8.GetBytes(cmObjectErrorArrayResponse)))
            {
                CMObjectFetchResponse<CMOBjectMock> response =
                    new CMObjectFetchResponse<CMOBjectMock>(new CMResponse(HttpStatusCode.Unauthorized, data));

                Assert.AreEqual(response.Status, HttpStatusCode.Unauthorized);
                Assert.AreEqual(response.HasErrors, true);
                Assert.AreEqual(response.Errors.Count, 1);
                Assert.AreEqual(response.Errors["Unauthorized"], "Unauthorized");
            };
        }