private ContentAccessor VersionTest(string contentTypeName)
{
VersionNumber originalValue;
VersionNumber currentValue;
string handlerValue;
string fieldName = "VersionNumber";
VersionNumber defaultValue = null;
VersionNumber testValue = new VersionNumber(5, 6, VersionStatus.Draft);
string defaultHandlerValue = (string)PropertyType.GetDefaultValue(DataType.String);
string testHandlerValue = testValue.ToString();
Content content = Content.CreateNew(contentTypeName, Repository.Root, "FieldTest");
ContentAccessor contentAcc = new ContentAccessor(content);
originalValue = (VersionNumber)content.Fields[fieldName].OriginalValue;
Assert.IsTrue(originalValue == defaultValue, contentTypeName + "#1");
currentValue = (VersionNumber)content[fieldName];
Assert.IsTrue(currentValue == defaultValue, contentTypeName + "#2");
handlerValue = (string)content.ContentHandler[fieldName];
Assert.IsTrue(handlerValue == defaultHandlerValue, contentTypeName + "#3");
content[fieldName] = testValue;
originalValue = (VersionNumber)content.Fields[fieldName].OriginalValue;
Assert.IsTrue(originalValue == defaultValue, contentTypeName + "#4");
currentValue = (VersionNumber)content[fieldName];
Assert.IsTrue(currentValue == testValue, contentTypeName + "#5");
contentAcc.SaveFields();
originalValue = (VersionNumber)content.Fields[fieldName].OriginalValue;
Assert.IsTrue(originalValue == testValue, contentTypeName + "#6");
currentValue = (VersionNumber)content[fieldName];
Assert.IsTrue(currentValue == testValue, contentTypeName + "#7");
handlerValue = (string)content.ContentHandler[fieldName];
Assert.IsTrue(handlerValue == testHandlerValue, contentTypeName + "#8");
content[fieldName] = defaultValue;
originalValue = (VersionNumber)content.Fields[fieldName].OriginalValue;
Assert.IsTrue(originalValue == testValue, contentTypeName + "#9");
currentValue = (VersionNumber)content[fieldName];
Assert.IsTrue(currentValue == defaultValue, contentTypeName + "#10");
contentAcc.SaveFields();
originalValue = (VersionNumber)content.Fields[fieldName].OriginalValue;
Assert.IsTrue(originalValue == defaultValue, contentTypeName + "#11");
currentValue = (VersionNumber)content[fieldName];
Assert.IsTrue(currentValue == defaultValue, contentTypeName + "#12");
handlerValue = (string)content.ContentHandler[fieldName];
//Assert.IsTrue(handlerValue == defaultHandlerValue, contentTypeName + "#13");
Assert.IsTrue(handlerValue == defaultHandlerValue, contentTypeName + "####13: Storage2: Expected: [null], current: [empty]");
return contentAcc;
}