public void SimpleInterfaceCopyWithRecursion() { // ARRAGE BClassWithRecursion original = new BClassWithRecursion() { id = 69, Age = 23, Name = "Bloodthirst" }; original.Recursion = original; Stopwatch profile = new Stopwatch(); // ACT profile.Start(); IBClass copy = interfaceCopier.Copy(original); profile.Stop(); TestContext.Out.WriteLine($"Time for copying {nameof(IBClass)} : { profile.ElapsedTicks } ticks = { profile.ElapsedMilliseconds } ms "); // ASSERT Assert.AreNotSame(original, copy); Assert.IsInstanceOf <BClassWithRecursion>(original); Assert.IsInstanceOf <BClassWithRecursion>(copy); Assert.AreSame(original.Name, copy.Name); }
protected string BClassFileName(IBClass bClass) { StringBuilder sb = new StringBuilder(); sb.Append(HelpMeReflect.AttributeStringData(bClass.GetType(), typeof(BClass), "Description")); sb.Append(".txt"); return(sb.ToString()); }
protected string BClassToString(IBClass bClass) { List <PropertyInfo> properties = HelpMeReflect.PropertiesWithBPropertyAttribute(bClass.GetType()); StringBuilder sb = new StringBuilder(); foreach (PropertyInfo property in properties) { string propertyName = HelpMeReflect.AttributeOfType <BProperty>(property).Description; string propertyValue = HelpMeReflect.PropertyValueString(bClass, property); sb.Append($"{propertyName}={propertyValue}{DELIMITER}"); } return(sb.ToString()); }
protected string BClassFullyQualifiedFileName(IBClass bClass) { return($@"{this.Path}\\{BClassFileName(bClass)}"); }
public AClass(IBClass b) { this.b = b; }