public void GivenACustomFieldValue_WhenUpdate_ThenContextSetsModified()
        {
            var expected = new CustomFieldValue { Id = 1 };

            Target.Update(expected);

            MockContext.AssertWasCalled(m => m.SetModified(expected));
        }
        public void GivenACustomFieldValue_WhenDelete_ThenRemoveFromContext()
        {
            var item = new CustomFieldValue { Id = 1 };

            Target.Remove(item);

            MockDbSet.AssertWasCalled(m => m.Remove(item));
        }
        public void GivenACustomFieldValue_WhenAdd_ThenAddToContext()
        {
            var expected = new CustomFieldValue { Id = 1 };

            Target.Add(expected);

            MockDbSet.AssertWasCalled(m => m.Add(expected));
        }
 public void Update(CustomFieldValue item)
 {
     Context.SetModified(item);
 }
 public void Remove(CustomFieldValue item)
 {
     Context.CustomFieldValues.Remove(item);
 }
 public void Add(CustomFieldValue item)
 {
     Context.CustomFieldValues.Add(item);
 }
 private void ProcessRowCell(UploadWizardCompleteModel model, CustomDataOrigin origin, Dictionary<int, CustomField> customFieldsDicitonary, int rowNum, DataRow row, Student student, ref bool successfulRow, ref int nonIdColumns, List<CustomFieldValue> rowCustomFieldValues, int i)
 {
     string fieldValue = row[i].ToString();
     if (!string.IsNullOrWhiteSpace(fieldValue))
     {
         nonIdColumns++;
         int integerTest;
         if (customFieldsDicitonary[i].CustomFieldType.Name.Equals("Integer") && !int.TryParse(fieldValue, out integerTest))
         {
             successfulRow = false;
             ProcessError(row, string.Format(CultureInfo.CurrentCulture, "Custom field {0} on row {1} is malformed", i + 1, rowNum + 2), model);
         }
         else
         {
             DateTime dateTest;
             if (customFieldsDicitonary[i].CustomFieldType.Name.Equals("Date") && !DateTime.TryParse(fieldValue, out dateTest))
             {
                 successfulRow = false;
                 ProcessError(row, string.Format(CultureInfo.CurrentCulture, "Custom field {0} on row {1} is malformed", i + 1, rowNum + 2), model);
             }
             else
             {
                 var value = new CustomFieldValue
                 {
                     CustomDataOriginId = origin.Id,
                     StudentId = student.Id,
                     CustomFieldId = customFieldsDicitonary[i].Id,
                     Value = fieldValue
                 };
                 rowCustomFieldValues.Add(value);
             }
         }
     }
 }