SenseNet.ContentRepository.Tests.FieldTest.WhoAndWhenTest C# (CSharp) Метод

WhoAndWhenTest() приватный Метод

private WhoAndWhenTest ( string contentTypeName ) : ContentAccessor
contentTypeName string
Результат ContentAccessor
        private ContentAccessor WhoAndWhenTest(string contentTypeName)
        {
            WhoAndWhenField.WhoAndWhenData originalValue;
            WhoAndWhenField.WhoAndWhenData currrenValue;
            //WhoAndWhenField.WhoAndWhenData defultValue;
            //WhoAndWhenField.WhoAndWhenData testValue;
            User originalUserValue;
            User currentUserValue;
            NodeList<Node> handlerUserValue;
            DateTime originalDateValue;
            DateTime currentDateValue;
            DateTime handlerDateValue;
            string fieldName = "WhoAndWhen";
            string userPropertyName = "Who";
            string datePropertyName = "When";
            User defaultUserValue = null;
            User testUserValue = User.Administrator;
            DateTime defaultDateValue = DateTime.MinValue;
            DateTime testDateValue = new DateTime(2001, 4, 17);
            DateTime defaultHandlerDateValue = defaultDateValue;
            DateTime testHandlerDateValue = testDateValue;

            Content content = Content.CreateNew(contentTypeName, Repository.Root, "FieldTest");
            ContentAccessor contentAcc = new ContentAccessor(content);

            originalValue = (WhoAndWhenField.WhoAndWhenData)content.Fields[fieldName].OriginalValue;
            Assert.IsTrue(originalValue.Who == defaultUserValue && ItIsDateTimeDefault(originalValue.When), contentTypeName + "####1 Storage2: DateTime default value");
            //Assert.IsTrue(originalValue.Who == defaultUserValue && ((TimeSpan)(DateTime.Now - originalValue.When)).TotalMinutes < 1, contentTypeName + "####1 Storage2: DateTime default value");
            currrenValue = (WhoAndWhenField.WhoAndWhenData)content[fieldName];
            Assert.IsTrue(currrenValue.Who == defaultUserValue && ItIsDateTimeDefault(currrenValue.When), contentTypeName + "#2");
            handlerUserValue = (NodeList<Node>)content.ContentHandler[userPropertyName];
            handlerDateValue = (DateTime)content.ContentHandler[datePropertyName];
            Assert.IsTrue(handlerUserValue.Count == 0 && ItIsDateTimeDefault(handlerDateValue), contentTypeName + "#3");

            content[fieldName] = new WhoAndWhenField.WhoAndWhenData(testUserValue, testDateValue);
            originalValue = (WhoAndWhenField.WhoAndWhenData)content.Fields[fieldName].OriginalValue;
            originalUserValue = originalValue.Who;
            originalDateValue = originalValue.When;
            Assert.IsTrue(originalUserValue == defaultUserValue && ItIsDateTimeDefault(originalDateValue), contentTypeName + "#1");
            currrenValue = (WhoAndWhenField.WhoAndWhenData)content[fieldName];
            currentUserValue = currrenValue.Who;
            currentDateValue = currrenValue.When;
            Assert.IsTrue(currentUserValue == testUserValue && currentDateValue == testDateValue, contentTypeName + "#5");
            contentAcc.SaveFields();
            originalValue = (WhoAndWhenField.WhoAndWhenData)content.Fields[fieldName].OriginalValue;
            originalUserValue = originalValue.Who;
            originalDateValue = originalValue.When;
            Assert.IsTrue(originalUserValue.Id == testUserValue.Id && originalDateValue == testDateValue, contentTypeName + "#6");
            currrenValue = (WhoAndWhenField.WhoAndWhenData)content[fieldName];
            currentUserValue = currrenValue.Who;
            currentDateValue = currrenValue.When;
            Assert.IsTrue(currentUserValue == testUserValue && currentDateValue == testDateValue, contentTypeName + "#7");
            handlerUserValue = (NodeList<Node>)content.ContentHandler[userPropertyName];
            handlerDateValue = (DateTime)content.ContentHandler[datePropertyName];
            Assert.IsTrue(handlerUserValue[0].Id == User.Administrator.Id && handlerDateValue == testDateValue, contentTypeName + "#8");

            WhoAndWhenField.WhoAndWhenData defaultValue = new WhoAndWhenField.WhoAndWhenData();
            defaultValue.Who = defaultUserValue;
            defaultValue.When = DateTime.Now;
            content[fieldName] = defaultValue;
            originalValue = (WhoAndWhenField.WhoAndWhenData)content.Fields[fieldName].OriginalValue;
            originalUserValue = originalValue.Who;
            originalDateValue = originalValue.When;
            Assert.IsTrue(originalUserValue.Id == testUserValue.Id && originalDateValue == testDateValue, contentTypeName + "#9");
            currrenValue = (WhoAndWhenField.WhoAndWhenData)content[fieldName];
            currentUserValue = currrenValue.Who;
            currentDateValue = currrenValue.When;
            Assert.IsTrue(currentUserValue == defaultUserValue && ItIsDateTimeDefault(currentDateValue), contentTypeName + "#10");
            contentAcc.SaveFields();
            originalValue = (WhoAndWhenField.WhoAndWhenData)content.Fields[fieldName].OriginalValue;
            originalUserValue = originalValue.Who;
            originalDateValue = originalValue.When;
            Assert.IsTrue(originalUserValue == defaultUserValue && ItIsDateTimeDefault(originalDateValue), contentTypeName + "#11");
            currrenValue = (WhoAndWhenField.WhoAndWhenData)content[fieldName];
            currentUserValue = currrenValue.Who;
            currentDateValue = currrenValue.When;
            Assert.IsTrue(currentUserValue == defaultUserValue && ItIsDateTimeDefault(currentDateValue), contentTypeName + "#12");
            handlerUserValue = (NodeList<Node>)content.ContentHandler[userPropertyName];
            handlerDateValue = (DateTime)content.ContentHandler[datePropertyName];
            Assert.IsTrue(handlerUserValue.Count == 0, contentTypeName + "#13");
            Assert.IsTrue(ItIsDateTimeDefault(handlerDateValue), contentTypeName + "#14");

            return contentAcc;
        }
        private ContentAccessor NumberTest(string contentTypeName)
FieldTest