public void TestCSEntryChangeSplitCSEntries() { List <CSEntryChange> incomingchanges = new List <CSEntryChange>(); ObjectModificationType objectModificationType = ObjectModificationType.Add; AcmaSchemaAttribute testAttribute1 = ActiveConfig.DB.GetAttribute("supervisor"); AcmaSchemaAttribute testAttribute2 = ActiveConfig.DB.GetAttribute("accountName"); CSEntryChange csentry; Guid reference = Guid.NewGuid(); csentry = CreateNewCSEntry(objectModificationType); csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(testAttribute1.Name, reference)); csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(testAttribute2.Name, "testuser")); incomingchanges.Add(csentry); CSEntryChange csentry2; csentry2 = CreateNewCSEntry(objectModificationType); csentry2.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(testAttribute2.Name, "testuser")); incomingchanges.Add(csentry2); List <CSEntryChange> changes = CSEntryChangeExtensions.SplitReferenceUpdatesFromCSEntryChanges(incomingchanges).ToList(); if (changes.Count != 3) { Assert.Fail("The operation returned the incorrect number of changes"); } }
public void TestCSEntryChangeSplitCSEntry() { ObjectModificationType objectModificationType = ObjectModificationType.Add; AcmaSchemaAttribute testAttribute1 = ActiveConfig.DB.GetAttribute("supervisor"); AcmaSchemaAttribute testAttribute2 = ActiveConfig.DB.GetAttribute("accountName"); CSEntryChange csentry; Guid reference = Guid.NewGuid(); csentry = CreateNewCSEntry(objectModificationType); csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(testAttribute1.Name, reference)); csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(testAttribute2.Name, "testuser")); List <CSEntryChange> changes = CSEntryChangeExtensions.SplitReferenceUpdatesFromCSEntryChangeAdd(csentry).ToList(); if (changes.Count != 2) { Assert.Fail("The operation did not return the correct number of CSEntryChangeObjects"); } CSEntryChange addChange = changes[0]; if (addChange.ObjectModificationType != ObjectModificationType.Add) { Assert.Fail("The operation did not correct set the object modification type"); } if (addChange.AttributeChanges.Count != 1) { Assert.Fail("The operation did not return the correct number of attribute changes"); } if (addChange.AttributeChanges[0].Name != testAttribute2.Name) { Assert.Fail("The operation did not correctly split the reference attributes from the CSEntryChange"); } if (addChange.AttributeChanges[0].ValueChanges[0].Value.ToString() != "testuser") { Assert.Fail("The operation did not correctly update the attribute change with the correct value"); } CSEntryChange updateChange = changes[1]; if (updateChange.ObjectModificationType != ObjectModificationType.Update) { Assert.Fail("The operation did not correct set the object modification type"); } if (updateChange.AttributeChanges.Count != 1) { Assert.Fail("The operation did not return the correct number of attribute changes"); } if (updateChange.AttributeChanges[0].Name != testAttribute1.Name) { Assert.Fail("The operation did not correctly split the reference attributes from the CSEntryChange"); } if (updateChange.AttributeChanges[0].ValueChanges[0].Value.ToString() != reference.ToString()) { Assert.Fail("The operation did not correctly update the attribute change with the correct value"); } }