public void GenericAction_SingleContent() { ODataTests.CreateTestSite(); try { ODataTests.Entity entity; using (var output = new System.IO.StringWriter()) { var pc = ODataTests.CreatePortalContext("/OData.svc/Root('IMS')/TestAction3", "", output); var handler = new ODataHandler(); var stream = ODataTests.CreateRequestStream(String.Concat("{ path: '", User.Administrator.Path, "' }")); handler.ProcessRequest(pc.OwnerHttpContext, "POST", stream); entity = ODataTests.GetEntity(output); } Assert.AreEqual(1, entity.Id); } finally { ODataTests.CleanupTestSite(); } }
public void Aspect_OData_LongTextDoesNotContainCdata() { var fieldValue = "<p>Field value</p>"; var aspect = EnsureAspect("LongTextTest"); aspect.AddFields(new FieldInfo { Name = "Field1", Type = "LongText" }); var content = Content.CreateNew("Car", TestRoot, Guid.NewGuid().ToString()); content.AddAspects(aspect); content["LongTextTest.Field1"] = fieldValue; content.Save(); var uri = ODataTools.GetODataUrl(content); ODataTests.CreateTestSite(); ODataTests.Entity entity; try { using (var output = new System.IO.StringWriter()) { var pc = ODataTests.CreatePortalContext(uri, "", output); var handler = new ODataHandler(); handler.ProcessRequest(pc.OwnerHttpContext, "GET", null); entity = ODataTests.GetEntity(output); } var value = entity.AllProperties["LongTextTest.Field1"]; var jvalue = value as JValue; var stringValue = (string)jvalue.Value; Assert.AreEqual(fieldValue, stringValue); } finally { ODataTests.CleanupTestSite(); } }