public async Task VerifyCallbackPopulatesResultingGroup()
        {
            var groupArtifactID = 1234;
            var groupName       = "Existing Group";

            var mockGroupRepo = new Mock <IGenericRepository <Group> >();
            FieldValueList <Group> resultingGroupList = null;
            var groupValidation = new ValidationGroup(new APIOptions(), mockGroupRepo.Object, x => resultingGroupList = x);

            var mockResult = new QueryResultSet <Group>
            {
                Success = true,
                Results = new List <Result <Group> >
                {
                    new Result <Group>
                    {
                        Artifact = new Group(groupArtifactID)
                        {
                            Name = groupName
                        }
                    }
                }
            };

            mockGroupRepo.Setup(x => x.Query(It.IsAny <Query <Group> >(), It.IsAny <Int32>())).Returns(mockResult);

            await groupValidation.ValidateAsync(groupName);

            Assert.IsTrue(resultingGroupList != null);
            Assert.IsTrue(resultingGroupList.Count == mockResult.Results.Count);
            Assert.IsTrue(resultingGroupList[0].ArtifactID == groupArtifactID);
        }
Example #2
0
 public static void SetFieldList(ref FieldValueList fieldSet, uint fieldID, object fieldValue)
 {
     if (fieldValue != null)
     {
         fieldSet[fieldID] = fieldValue;
     }
 }
Example #3
0
        public void UpdateResource()
        {
            System.Diagnostics.Debug.Assert(SelectedResource != null);

            SelectedResource.Name = fieldName.FieldText;

            /// fill in additional fields
            foreach (SNAP.ResourceFields.AbstractField fieldControl in this.Fields.Values)
            {
                FieldValueList fieldValue = null;
                if (!SelectedResource.Fields.ContainsKey(fieldControl.FieldName))
                {
                    // TODO: make this simpler
                    fieldValue =
                        new FieldValueList(SelectedResource.ResourceType.Fields[fieldControl.FieldName]);
                    SelectedResource.Fields[fieldControl.FieldName] = fieldValue;
                }
                else
                {
                    fieldValue = SelectedResource.Fields[fieldControl.FieldName];
                }

                fieldValue.Values.Clear();
                fieldControl.SaveToFieldValue(fieldValue);
            }
        }
        public async Task <String> ValidateAsync(String input)
        {
            String validationMessage = null;
            var    returnGroups      = new FieldValueList <Group>();

            if (!String.IsNullOrWhiteSpace(input))
            {
                try
                {
                    input = input.Trim(Constant.ViolationDelimiter.ToCharArray()[0]);
                    var groupList        = input.Split(Constant.ViolationDelimiter.ToCharArray()[0]);
                    var missingGroupList = new List <String>();
                    var query            = new ArtifactQueries();
                    var groupQueryResult = await query.QueryGroupsAsync(_apiOptions, _groupRepository, groupList);

                    if (groupQueryResult.Success && groupQueryResult.Results.Count > 0)
                    {
                        var results = groupQueryResult.Results;
                        foreach (var group in groupList)
                        {
                            var matchingGroup = results.FirstOrDefault(x => x.Artifact.Name == group.Trim());
                            if (matchingGroup == null)
                            {
                                missingGroupList.Add(group);
                            }
                            else
                            {
                                returnGroups.Add(new Group(matchingGroup.Artifact.ArtifactID));
                            }
                        }

                        if (missingGroupList.Any())
                        {
                            validationMessage = String.Format(Constant.Messages.Violations.GroupDoesNotExist, String.Join(Constant.ViolationDelimiter, missingGroupList));
                        }
                    }
                    else if (groupQueryResult.Success)
                    {
                        validationMessage = String.Format(Constant.Messages.Violations.GroupDoesNotExist, input);
                    }
                    else
                    {
                        validationMessage = groupQueryResult.Message;
                    }
                }
                catch (Exception ex)
                {
                    validationMessage = String.Format(Constant.Messages.Violations.Exception, $"querying the following querying the groups related to this user: {input}", ex);
                }
            }
            _callback(returnGroups);

            return(validationMessage);
        }
Example #5
0
        /// <summary>
        /// This call lists the field values for the box specified.
        /// Note: for fields that have no value set, the value property is ommitted from the returned JSON
        /// </summary>
        /// <param name="boxKey">The key of the box</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">Please specify a box key!</exception>
        public FieldValueList ListFieldValuesForBox(string boxKey)
        {
            if (string.IsNullOrEmpty(boxKey))
            {
                throw new ArgumentNullException(nameof(boxKey), "Please specify a box key!");
            }
            var fieldList = new FieldValueList
            {
                RawApiResponse = _rawFieldServices.ListFieldValuesForBox(boxKey)
            };

            fieldList.FieldValues    = JsonConvert.DeserializeObject <List <FieldValue> >(fieldList.RawApiResponse.Json);
            fieldList.RawApiResponse = GetRawApiResponseOrNull(fieldList.RawApiResponse);
            return(fieldList);
        }
Example #6
0
        public string SetFormEntry(string formName, FieldValueList fieldSet)
        {
            LogHelper.LogTextDebug(formName, "Update Request");
            try
            {
                _arserver.SetEntry(formName, ARRequestId, fieldSet);
            }
            catch (ARException objARException)
            {
                LogHelper.LogTextFatal(objARException.Message, "Exception");
                throw new CustomError("RemedyAPIError", objARException.Message);
            }

            LogHelper.LogTextDebug(ARRequestId, "Request Updated");
            return(ARRequestId);
        }
Example #7
0
        public string CreateFormEntry(string formName, FieldValueList fieldSet)
        {
            LogHelper.LogTextDebug(formName, "Create Request");

            string newRequestID;

            try
            {
                newRequestID = _arserver.CreateEntry(formName, fieldSet);
            }
            catch (ARException objARException)
            {
                LogHelper.LogTextFatal(objARException.Message, "Exception");
                throw new CustomError("RemedyAPIError", objARException.Message);
            }

            LogHelper.LogTextDebug(newRequestID, "Request Created");
            return(newRequestID);
        }
Example #8
0
            private Resource LoadResource(System.Xml.XmlNode node, Resource parent)
            {
                System.Diagnostics.Debug.Assert(node.Name == "resource");

                /// get resource type
                string resourceTypeName = node.Attributes["type"].Value;

                SNAP.Resources.ResourceType resourceType = _resourceTypes[resourceTypeName];

                /// get resource name
                string resourceName = node.Attributes["name"].Value;

                /// get resource id
                /// if the id is not available (for instance when importing an externallay generated resource)
                /// generate a new one instead
                Guid guid = (node.Attributes["id"] != null) ?
                            (new Guid(node.Attributes["id"].Value)) : (Guid.NewGuid());

                /// create the new resource
                Resource resource = new Resource(guid, resourceType, resourceName);

                /// add field values
                foreach (System.Xml.XmlNode fieldNode in node.SelectNodes("field"))
                {
                    string         fieldName  = fieldNode.Attributes["name"].Value;
                    FieldType      fieldType  = resource.ResourceType.Fields[fieldName];
                    FieldValueList fieldValue = null;
                    if (!resource.Fields.ContainsKey(fieldName))
                    {
                        fieldValue = new FieldValueList(fieldType);
                        resource.Fields.Add(fieldName, fieldValue);
                    }
                    else
                    {
                        fieldValue = resource.Fields[fieldName];
                    }

                    IScriptableValue value = null;
                    switch (fieldType.Type)
                    {
                    case "internal_ref":
                        value = new InternalRefValue(fieldNode.InnerText);
                        break;

                    case "external_ref":
                        value = new ExternalRefValue(fieldNode.InnerText);
                        break;

                    case "text":
                        value = new TextValue(fieldNode.InnerText);
                        break;

                    default:
                        System.Diagnostics.Debug.Fail(fieldType.Type + " is not a recognized field type");
                        break;
                    }

                    fieldValue.Values.Add(value);
                }

                /// add this node to it's parent
                if (parent == null)
                {
                    string family = node["family"].InnerText;
                    parent = _resourceList[family];
                }
                parent.Children.Add(resource);
                return(resource);
            }
Example #9
0
        public RDO ToRdo()
        {
            RelativityObjectAttribute objectTypeAttribute = this.GetType().GetCustomAttribute <RelativityObjectAttribute>(false);
            RDO rdo = new RDO(objectTypeAttribute.ObjectTypeGuid, ArtifactId);

            var parentProperty = this.GetParentArtifactIdProperty();

            if (parentProperty != null)
            {
                var parentId = parentProperty.GetValue(this, null);
                if (parentId != null)
                {
                    rdo.ParentArtifact = new kCura.Relativity.Client.DTOs.Artifact((int)parentId);
                }
            }

            foreach (PropertyInfo property in this.GetType().GetPublicProperties())
            {
                object theFieldValue = null;

                RelativityObjectFieldAttribute fieldAttribute = property.GetCustomAttribute <RelativityObjectFieldAttribute>();

                if (fieldAttribute != null)
                {
                    object propertyValue = property.GetValue(this);
                    if (propertyValue != null && fieldAttribute.FieldType != (int)RdoFieldType.File)
                    {
                        switch (fieldAttribute.FieldType)
                        {
                        case (int)RdoFieldType.Currency:
                        case (int)RdoFieldType.Date:
                        case (int)RdoFieldType.Decimal:
                        case (int)RdoFieldType.Empty:
                        case (int)RdoFieldType.LongText:
                        case (int)RdoFieldType.WholeNumber:
                        case (int)RdoFieldType.YesNo:
                        case (int)RdoFieldType.User:
                            theFieldValue = propertyValue;
                            break;

                        case (int)RdoFieldType.FixedLengthText:
                            int stringLenght;
                            stringLenght = property.GetCustomAttribute <RelativityObjectFieldAttribute>().Length != null?
                                           property.GetCustomAttribute <RelativityObjectFieldAttribute>().Length.Value:
                                           3000;

                            string theString = propertyValue as string;
                            if (string.IsNullOrEmpty(theString) == false && theString.Length > stringLenght)
                            {
                                theString  = theString.Substring(0, (stringLenght - 3));
                                theString += "...";
                            }

                            theFieldValue = theString;
                            break;

                        case (int)RdoFieldType.MultipleChoice:
                            // We have IList<Enum> values here
                            var multiChoiceFieldValueList = new MultiChoiceFieldValueList();

                            IEnumerable enumEnumerable = propertyValue as IEnumerable;
                            Type        entryType      = enumEnumerable.AsQueryable().ElementType;

                            var enumValues = Enum.GetValues(entryType);
                            foreach (var enumValueObject in enumEnumerable)
                            {
                                var memberInfo = entryType.GetMember(enumValueObject.ToString());
                                var relativityObjectAttribute = memberInfo[0].GetCustomAttribute <RelativityObjectAttribute>();
                                multiChoiceFieldValueList.Add(new kCura.Relativity.Client.DTOs.Choice(relativityObjectAttribute.ObjectTypeGuid));
                            }

                            theFieldValue = multiChoiceFieldValueList;
                            break;

                        case (int)RdoFieldType.MultipleObject:
                            var listOfObjects = new FieldValueList <kCura.Relativity.Client.DTOs.Artifact>();

                            foreach (int artifactId in (IList <int>)propertyValue)
                            {
                                listOfObjects.Add(new kCura.Relativity.Client.DTOs.Artifact(artifactId));
                            }

                            theFieldValue = listOfObjects;
                            break;

                        case (int)RdoFieldType.SingleChoice:

                            bool isEnumDefined = Enum.IsDefined(propertyValue.GetType(), propertyValue);

                            if (isEnumDefined == true)
                            {
                                var choiceGuid = propertyValue.GetType().GetMember(propertyValue.ToString())[0].GetCustomAttribute <RelativityObjectAttribute>().ObjectTypeGuid;
                                theFieldValue = new kCura.Relativity.Client.DTOs.Choice(choiceGuid);
                            }
                            break;

                        case (int)RdoFieldType.SingleObject:
                            if ((int)propertyValue > 0)
                            {
                                theFieldValue = new kCura.Relativity.Client.DTOs.Artifact((int)propertyValue);
                            }
                            break;

                        case SharedConstants.FieldTypeCustomListInt:
                            theFieldValue = ((IList <int>)propertyValue).ToSeparatedString(SharedConstants.ListIntSeparatorChar);
                            break;

                        case SharedConstants.FieldTypeByteArray:
                            theFieldValue = Convert.ToBase64String((byte[])propertyValue);
                            break;
                        }

                        rdo.Fields.Add(new FieldValue(fieldAttribute.FieldGuid, theFieldValue));
                    }
                }
            }

            foreach (PropertyInfo property in this.GetType().GetPublicProperties())
            {
                object theFieldValue = null;
                RelativitySingleObjectAttribute   singleObjectAttribute   = property.GetCustomAttribute <RelativitySingleObjectAttribute>();
                RelativityMultipleObjectAttribute multipleObjectAttribute = property.GetCustomAttribute <RelativityMultipleObjectAttribute>();

                if (singleObjectAttribute != null)
                {
                    int fieldsWithSameGuid = rdo.Fields.Where(c => c.Guids.Contains(singleObjectAttribute.FieldGuid)).Count();

                    if (fieldsWithSameGuid == 0)
                    {
                        object propertyValue = property.GetValue(this);
                        if (propertyValue != null)
                        {
                            int artifactId = (int)propertyValue.GetType().GetProperty("ArtifactId").GetValue(propertyValue, null);
                            if (artifactId != 0)
                            {
                                theFieldValue = new kCura.Relativity.Client.DTOs.Artifact(artifactId);
                                rdo.Fields.Add(new FieldValue(singleObjectAttribute.FieldGuid, theFieldValue));
                            }
                            else
                            {
                                theFieldValue = null;
                                rdo.Fields.Add(new FieldValue(singleObjectAttribute.FieldGuid, theFieldValue));
                            }
                        }
                    }
                }

                if (multipleObjectAttribute != null)
                {
                    int fieldsWithSameGuid = rdo.Fields.Where(c => c.Guids.Contains(multipleObjectAttribute.FieldGuid)).Count();

                    if (fieldsWithSameGuid == 0)
                    {
                        object propertyValue = property.GetValue(this);
                        if (propertyValue != null)
                        {
                            var listOfObjects = new FieldValueList <kCura.Relativity.Client.DTOs.Artifact>();

                            foreach (var objectValue in propertyValue as IList)
                            {
                                int artifactId = (int)objectValue.GetType().GetProperty("ArtifactId").GetValue(objectValue, null);

                                listOfObjects.Add(new kCura.Relativity.Client.DTOs.Artifact(artifactId));
                            }

                            theFieldValue = listOfObjects;
                            rdo.Fields.Add(new FieldValue(multipleObjectAttribute.FieldGuid, theFieldValue));
                        }
                    }
                }
            }

            return(rdo);
        }
Example #10
0
        /// <summary>
        /// Відбір
        /// </summary>
        //protected List<Where> BaseFilter { get; }

        /// <summary>
        /// Очищення вн. списків
        /// </summary>
        protected void BaseClear()
        {
            FieldValueList.Clear();
        }
Example #11
0
        public void UpdateField <T>(int rdoID, Guid fieldGuid, object value)
            where T : BaseDto, new()
        {
            RDO theRdo = new RDO(rdoID);

            theRdo.ArtifactTypeGuids.Add(BaseDto.GetObjectTypeGuid <T>());

            Type fieldType = typeof(T).GetProperties().Where(p => p.GetFieldGuidValueFromAttribute() == fieldGuid).FirstOrDefault().PropertyType;

            if (fieldType.IsGenericType)
            {
                if (fieldType.GetGenericTypeDefinition() == typeof(IList <>))
                {
                    if ((value as IList).HeuristicallyDetermineType().IsEnum)
                    {
                        MultiChoiceFieldValueList choices = new MultiChoiceFieldValueList();
                        List <Guid> choiceValues          = new List <Guid>();
                        foreach (var enumValue in (value as IList))
                        {
                            choices.Add(new kCura.Relativity.Client.DTOs.Choice(((Enum)enumValue).GetRelativityObjectAttributeGuidValue()));
                        }

                        theRdo.Fields.Add(new FieldValue(fieldGuid, choices));
                    }

                    if (value.GetType().GetGenericArguments() != null && value.GetType().GetGenericArguments().Length != 0)
                    {
                        if (value.GetType().GetGenericArguments()[0].IsSubclassOf(typeof(BaseDto)))
                        {
                            var listOfObjects = new FieldValueList <kCura.Relativity.Client.DTOs.Artifact>();

                            foreach (var objectValue in value as IList)
                            {
                                listOfObjects.Add(new kCura.Relativity.Client.DTOs.Artifact((int)objectValue.GetType().GetProperty("ArtifactId").GetValue(objectValue, null)));
                            }

                            theRdo.Fields.Add(new FieldValue(fieldGuid, listOfObjects));
                        }

                        if (value.GetType().GetGenericArguments()[0].IsEquivalentTo(typeof(int)))
                        {
                            var listOfObjects = new FieldValueList <kCura.Relativity.Client.DTOs.Artifact>();

                            foreach (var objectValue in value as IList)
                            {
                                listOfObjects.Add(new kCura.Relativity.Client.DTOs.Artifact((int)objectValue));
                            }

                            theRdo.Fields.Add(new FieldValue(fieldGuid, listOfObjects));
                        }
                    }
                }
                else if (value == null)
                {
                    theRdo.Fields.Add(new FieldValue(fieldGuid, value));
                }
                else if (value.GetType() == typeof(string) ||
                         value.GetType() == typeof(int) ||
                         value.GetType() == typeof(bool) ||
                         value.GetType() == typeof(decimal) ||
                         value.GetType() == typeof(DateTime))
                {
                    theRdo.Fields.Add(new FieldValue(fieldGuid, value));
                }

                UpdateRdo(theRdo);
            }
            else
            {
                RelativityObjectFieldAttribute fieldAttributeValue = typeof(T).GetProperties().Where(p => p.GetFieldGuidValueFromAttribute() == fieldGuid).FirstOrDefault().GetCustomAttribute <RelativityObjectFieldAttribute>();

                if (fieldAttributeValue != null)
                {
                    if (fieldAttributeValue.FieldType == (int)RdoFieldType.File)
                    {
                        if (value.GetType().BaseType != null)
                        {
                            if (value.GetType().BaseType.IsAssignableFrom(typeof(RelativityFile)))
                            {
                                InsertUpdateFileField(value as RelativityFile, rdoID);
                            }
                        }
                    }

                    if (fieldAttributeValue.FieldType == (int)RdoFieldType.User)
                    {
                        if (value.GetType() == typeof(User))
                        {
                            theRdo.Fields.Add(new FieldValue(fieldGuid, value));
                            UpdateRdo(theRdo);
                        }
                    }

                    if (value.GetType().IsEnum)
                    {
                        var choice = new kCura.Relativity.Client.DTOs.Choice(((Enum)value).GetRelativityObjectAttributeGuidValue());

                        theRdo.Fields.Add(new FieldValue(fieldGuid, choice));
                        UpdateRdo(theRdo);
                    }

                    if (value.GetType() == typeof(string) ||
                        value.GetType() == typeof(int) ||
                        value.GetType() == typeof(bool) ||
                        value.GetType() == typeof(decimal) ||
                        value.GetType() == typeof(DateTime))
                    {
                        theRdo.Fields.Add(new FieldValue(fieldGuid, value));
                        UpdateRdo(theRdo);
                    }
                }
            }
        }
Example #12
0
            private Resource LoadResource(System.Xml.XmlNode node, Resource parent)
            {
                System.Diagnostics.Debug.Assert(node.Name == "resource");

                /// get resource type
                string resourceTypeName = node.Attributes["type"].Value;
                SNAP.Resources.ResourceType resourceType = _resourceTypes[resourceTypeName];

                /// get resource name
                string resourceName = node.Attributes["name"].Value;

                /// get resource id
                /// if the id is not available (for instance when importing an externallay generated resource)
                /// generate a new one instead
                Guid guid = (node.Attributes["id"] != null) ?
                    (new Guid(node.Attributes["id"].Value)) : (Guid.NewGuid());

                /// create the new resource
                Resource resource = new Resource(guid, resourceType, resourceName);

                /// add field values
                foreach (System.Xml.XmlNode fieldNode in node.SelectNodes("field"))
                {
                    string fieldName = fieldNode.Attributes["name"].Value;
                    FieldType fieldType = resource.ResourceType.Fields[fieldName];
                    FieldValueList fieldValue = null;
                    if (!resource.Fields.ContainsKey(fieldName))
                    {
                        fieldValue = new FieldValueList(fieldType);
                        resource.Fields.Add(fieldName, fieldValue);
                    }
                    else
                    {
                        fieldValue = resource.Fields[fieldName];
                    }

                    IScriptableValue value = null;
                    switch (fieldType.Type)
                    {
                        case "internal_ref":
                            value = new InternalRefValue (fieldNode.InnerText);
                            break;

                        case "external_ref":
                            value = new ExternalRefValue (fieldNode.InnerText);
                            break;

                        case "text":
                            value = new TextValue (fieldNode.InnerText);
                            break;

                        default:
                            System.Diagnostics.Debug.Fail (fieldType.Type + " is not a recognized field type");
                            break;
                    }

                    fieldValue.Values.Add(value);
                }

                /// add this node to it's parent
                if (parent == null)
                {
                    string family = node["family"].InnerText;
                    parent = _resourceList[family];
                }
                parent.Children.Add(resource);
                return resource;
            }
Example #13
0
 public static void SetFieldList(ref FieldValueList fieldSet, uint fieldID, DateTime fieldValue)
 {
     fieldSet[fieldID] = fieldValue;
 }
Example #14
0
 //methods
 public static void SetFieldList(ref FieldValueList fieldSet, uint fieldID, string fieldValue)
 {
     fieldSet[fieldID] = fieldValue;
 }
        public void Valid_Gravity_RelativityObject_Read_Field_Type <T>(string objectPropertyName, T sampleData)
        {
            void Inner()
            {
                //Arrange
                LogStart($"Arrangement for property {objectPropertyName}");

                GravityLevelOne testObject = new GravityLevelOne()
                {
                    Name = $"TestObjectRead_{objectPropertyName}{Guid.NewGuid()}"
                };

                Guid         testObjectTypeGuid = testObject.GetObjectLevelCustomAttribute <RelativityObjectAttribute>().ObjectTypeGuid;
                Guid         nameFieldGuid      = testObject.GetCustomAttribute <RelativityObjectFieldAttribute>("Name").FieldGuid;
                var          testFieldAttribute = testObject.GetCustomAttribute <RelativityObjectFieldAttribute>(objectPropertyName);
                Guid         testFieldGuid      = testFieldAttribute.FieldGuid;
                RdoFieldType fieldType          = testObject.GetCustomAttribute <RelativityObjectFieldAttribute>(objectPropertyName).FieldType;

                _client.APIOptions.WorkspaceID = _workspaceId;

                object expectedData = sampleData;

                var dto = new RDO()
                {
                    ArtifactTypeGuids = new List <Guid> {
                        testObjectTypeGuid
                    }
                };
                int newArtifactId = -1;

                dto.Fields.Add(new FieldValue(nameFieldGuid, testObject.Name));

                int objectToAttachID;

                //need this mess because when passing in tests for decimal and currency System wants to use double and causes problems
                switch (fieldType)
                {
                case RdoFieldType.SingleChoice:
                    Enum   singleChoice      = (Enum)Enum.ToObject(sampleData.GetType(), sampleData);
                    Guid   singleChoiceGuid  = singleChoice.GetRelativityObjectAttributeGuidValue();
                    Choice singleChoiceToAdd = new Choice(singleChoiceGuid);
                    dto.Fields.Add(new FieldValue(testFieldGuid, singleChoiceToAdd));
                    break;

                case RdoFieldType.SingleObject:
                    int objectToAttach =
                        _testObjectHelper.CreateTestObjectWithGravity <GravityLevel2>(sampleData as GravityLevel2);
                    dto.Fields.Add(new FieldValue(testFieldGuid, objectToAttach));
                    expectedData = (sampleData as GravityLevel2).Name;
                    break;

                case RdoFieldType.MultipleObject:
                    IList <GravityLevel2>     gravityLevel2s = (IList <GravityLevel2>)sampleData;
                    FieldValueList <Artifact> objects        = new FieldValueList <Artifact>();
                    expectedData = new Dictionary <int, string>();
                    foreach (GravityLevel2 child in gravityLevel2s)
                    {
                        objectToAttachID =
                            _testObjectHelper.CreateTestObjectWithGravity <GravityLevel2>(child);
                        objects.Add(new Artifact(objectToAttachID));
                        (expectedData as Dictionary <int, string>).Add(objectToAttachID, child.Name);
                    }
                    dto.Fields.Add(new FieldValue(testFieldGuid, objects));
                    break;

                default:
                    dto.Fields.Add(new FieldValue(testFieldGuid, sampleData));
                    break;
                }

                WriteResultSet <RDO> writeResults = _client.Repositories.RDO.Create(dto);

                if (writeResults.Success)
                {
                    newArtifactId = writeResults.Results[0].Artifact.ArtifactID;
                    Console.WriteLine($"Object was created with Artifact ID {newArtifactId}.");
                }
                else
                {
                    Console.WriteLine($"An error occurred creating object: {writeResults.Message}");
                    foreach (var result in
                             writeResults.Results
                             .Select((item, index) => new { rdoResult = item, itemNumber = index })
                             .Where(x => x.rdoResult.Success == false))
                    {
                        Console.WriteLine($"An error occurred in create request {result.itemNumber}: {result.rdoResult.Message}");
                    }
                }

                LogEnd("Arrangement");

                //Act
                LogStart("Act");

                object gravityFieldValue = null;

                if (newArtifactId > 0)
                {
                    GravityLevelOne testGravityObject = _testObjectHelper.ReturnTestObjectWithGravity <GravityLevelOne>(newArtifactId);
                    gravityFieldValue = testGravityObject.GetPropertyValue(objectPropertyName);
                    if (gravityFieldValue != null)
                    {
                        switch (fieldType)
                        {
                        case RdoFieldType.SingleObject:
                            gravityFieldValue = ((GravityLevel2)gravityFieldValue).Name;
                            break;

                        case RdoFieldType.MultipleObject:
                            gravityFieldValue = ((List <GravityLevel2>)gravityFieldValue).ToDictionary(x => x.ArtifactId, x => x.Name);
                            break;
                        }
                    }
                }

                LogEnd("Act");

                //Assert
                LogStart("Assertion");

                if (newArtifactId > 0)
                {
                    Assert.AreEqual(expectedData, gravityFieldValue);
                }
                else
                {
                    Assert.Fail("Could not create object to test with through RSAPI. This is not a Gravity failure.");
                }

                LogEnd("Assertion");
            }

            TestWrapper(Inner);
        }