public void Copy_Honors_Cloneable_Properties() { Uri uri = new Uri("http://localhost"); MockCloneableProperty cloneable = new MockCloneableProperty { Id = 5, Name = "SomeName" }; ProcessorArgument arg = new ProcessorArgument("AName", typeof(string), uri, cloneable); ProcessorArgument argCopy = arg.Copy(); Assert.AreEqual(2, argCopy.Properties.Count, "The copied ProcessorArgument should have the same properties as the original ProcessorArgument."); Assert.AreSame(uri, argCopy.Properties.Find<Uri>(), "The copied ProcessorArgument should have the same property instance as the original ProcessorArgument."); Assert.AreNotSame(cloneable, argCopy.Properties.Find<MockCloneableProperty>(), "The copied ProcessorArgument should have a new property instance."); }
public void Copy_Creates_New_ProcessorArgument_With_Same_Name_Type_And_Properties() { ProcessorArgument arg = new ProcessorArgument("AName", typeof(string), 5); ProcessorArgument argCopy = arg.Copy(); Assert.IsNotNull(argCopy, "ProcessorArgument.Copy should not have returned null."); Assert.AreNotSame(arg, argCopy, "ProcessorArgument.Copy should have returned a new instance of ProcessorArgument."); Assert.AreEqual("AName", argCopy.Name, "The copied ProcessorArgument should have the same name as the original ProcessorArgument."); Assert.AreEqual("AName", arg.Name, "The original ProcessorArgument's name should not have changed."); Assert.AreEqual(typeof(string), argCopy.ArgumentType, "The copied ProcessorArgument should have the same type as the original ProcessorArgument."); Assert.AreEqual(typeof(string), arg.ArgumentType, "The original ProcessorArgument's type should not have changed."); Assert.AreEqual(1, argCopy.Properties.Count, "The copied ProcessorArgument should have the same properties as the original ProcessorArgument."); Assert.AreEqual(5, argCopy.Properties.Find<int>(), "The copied ProcessorArgument should have the same properties as the original ProcessorArgument."); Assert.AreEqual(1, arg.Properties.Count, "The original ProcessorArgument's properties should not have changed."); Assert.AreEqual(5, arg.Properties.Find<int>(), "The original ProcessorArgument's properties should have changed."); }
public void Copy_Creates_New_ProcessorArgument_Not_Attached_To_Any_Collection() { ProcessorArgument arg = new ProcessorArgument("AName", typeof(string)); MockNonGenericProcessor processor1 = new MockNonGenericProcessor(); processor1.SetInputArguments(arg); ProcessorArgumentCollection processor1InArguments = processor1.InArguments; ProcessorArgument argCopy = arg.Copy(); Assert.IsNotNull(argCopy, "ProcessorArgument.Copy should not have returned null."); Assert.AreNotSame(arg, argCopy, "ProcessorArgument.Copy should have returned a new instance of ProcessorArgument."); Assert.IsNotNull(arg.ContainingCollection, "The original ProcessorArgument should have had a containing collection."); Assert.IsNull(argCopy.ContainingCollection, "The copied ProcessorArgument should not belong to any containing collection."); Assert.IsNotNull(arg.Index, "The original processor argument should have an index since it belongs to a collection."); Assert.IsNull(argCopy.Index, "The copied processor argument should not have an index since it does not belong to any containing collection."); }