public void Test_Execute_Reference() { TestUser user = new TestUser(); user.ID = Guid.NewGuid(); user.FirstName = "-- First Name -- "; user.LastName = "-- Last Name --"; //user.Username = "******"; TestRole role = new TestRole(); role.ID = Guid.NewGuid(); role.Name = "-- Test Role --"; user.Roles = new TestRole[] {role}; string newTypeName = "TestAccount"; EntityReference reference = DataAccess.Data.Referencer.GetActiveReferences(user)[0]; XmlDocument document = XmlUtilities.SerializeToDocument(reference); RenameTypeCommand command = new RenameTypeCommand(); command.TypeName = user.ShortTypeName; command.NewTypeName = newTypeName; command.Execute(document); EntityReference updatedReference = (EntityReference)XmlUtilities.DeserializeFromDocument(document, typeof(EntityReference)); Assert.AreEqual(newTypeName, updatedReference.Type1Name, "The type name wasn't changed."); }
public void Test_Execute_Reference() { TestUser user = new TestUser(); user.ID = Guid.NewGuid(); user.FirstName = "-- First Name -- "; user.LastName = "-- Last Name --"; //user.Username = "******"; TestRole role = new TestRole(); role.ID = Guid.NewGuid(); role.Name = "-- Test Role --"; user.Roles = new TestRole[] { role }; string newTypeName = "TestAccount"; EntityReference reference = DataAccess.Data.Referencer.GetActiveReferences(user)[0]; XmlDocument document = XmlUtilities.SerializeToDocument(reference); RenameTypeCommand command = new RenameTypeCommand(); command.TypeName = user.ShortTypeName; command.NewTypeName = newTypeName; command.Execute(document); EntityReference updatedReference = (EntityReference)XmlUtilities.DeserializeFromDocument(document, typeof(EntityReference)); Assert.AreEqual(newTypeName, updatedReference.Type1Name, "The type name wasn't changed."); }
public void Test_Execute_Entity() { TestUser user = new TestUser(); user.ID = Guid.NewGuid(); user.FirstName = "-- First Name -- "; user.LastName = "-- Last Name --"; //user.Username = "******"; XmlDocument document = XmlUtilities.SerializeToDocument(user); RenameTypeCommand command = new RenameTypeCommand(); command.TypeName = user.ShortTypeName; command.NewTypeName = "TestAccount"; command.Execute(document); Assert.AreEqual("TestAccount", document.DocumentElement.Name, "The type name wasn't updated on the document element node."); TestAccount account = (TestAccount)XmlUtilities.DeserializeFromDocument(document, typeof(TestAccount)); Assert.AreEqual(user.FirstName, account.FirstName, "The properties don't match."); }