public void SmokeTest_empty_collections()
        {
            var stringWithReturns = "this is\r\na string\n\twith tabs\nand returns";
            var boringString = "i'm a bore";

            var child1 = new ObjectPrintable
            {
                String = boringString,
                Id = 17,
            };
            var child2 = new ObjectPrintable
            {
                String = stringWithReturns,
                Id = 33
            };

            var parent = new ObjectPrintable("Whos your daddy?")
            {
                String = "Parent",
                Id = 100,
                Child = child1,
                Array = new ObjectPrintable[0],
                Dictionary = new Dictionary<int, ObjectPrintable>(),
                Hashtable = new Hashtable(),
                NVC = new NameValueCollection()
            };

            child1.Parent = parent;
            child2.Parent = parent;

            var expected = @"[ObjectPrintable]: hashcode { $ignore$ }
{
	ToString() : Whos your daddy?
	String : Parent
	Id : 100
	Uri : {NULL}
	Child : [ObjectPrintable]: hashcode { $ignore$ }
	{
		String : i'm a bore
		Id : 17
		Uri : {NULL}
		Child : {NULL}
		Parent : avoid circular loop for this [ObjectPrintable]: hashcode { $ignore$ }
		Array : {NULL}
		Dictionary : {NULL}
		Hashtable : {NULL}
		NVC : {NULL}
		SomeEnumMember : SomeEnum.Enum22
	}
	Parent : {NULL}
	Array : [ObjectPrintable[]]: hashcode { $ignore$ }{}
	Dictionary : [Dictionary`2]: hashcode { $ignore$ }{}
	Hashtable : [Hashtable]: hashcode { $ignore$ }{}
	NVC : [NameValueCollection]: hashcode { $ignore$ }{}
	SomeEnumMember : SomeEnum.Enum22
}";

            shouldBeSame(expected, parent);
        }
        public void SmokeTest_empty_collections()
        {
            var stringWithReturns = "this is\r\na string\n\twith tabs\nand returns";
            var boringString      = "i'm a bore";

            var child1 = new ObjectPrintable
            {
                String = boringString,
                Id     = 17,
            };
            var child2 = new ObjectPrintable
            {
                String = stringWithReturns,
                Id     = 33
            };

            var parent = new ObjectPrintable("Whos your daddy?")
            {
                String     = "Parent",
                Id         = 100,
                Child      = child1,
                Array      = new ObjectPrintable[0],
                Dictionary = new Dictionary <int, ObjectPrintable>(),
                Hashtable  = new Hashtable(),
                NVC        = new NameValueCollection()
            };

            child1.Parent = parent;
            child2.Parent = parent;

            var expected = @"[ObjectPrintable]: hashcode { $ignore$ }
{
	ToString() : Whos your daddy?
	String : Parent
	Id : 100
	Uri : {NULL}
	Child : [ObjectPrintable]: hashcode { $ignore$ }
	{
		String : i'm a bore
		Id : 17
		Uri : {NULL}
		Child : {NULL}
		Parent : avoid circular loop for this [ObjectPrintable]: hashcode { $ignore$ }
		Array : {NULL}
		Dictionary : {NULL}
		Hashtable : {NULL}
		NVC : {NULL}
		SomeEnumMember : SomeEnum.Enum22
	}
	Parent : {NULL}
	Array : [ObjectPrintable[]]: hashcode { $ignore$ }{}
	Dictionary : [Dictionary`2]: hashcode { $ignore$ }{}
	Hashtable : [Hashtable]: hashcode { $ignore$ }{}
	NVC : [NameValueCollection]: hashcode { $ignore$ }{}
	SomeEnumMember : SomeEnum.Enum22
}";

            shouldBeSame(expected, parent);
        }
        private static ObjectPrintable build_general_use_case_including_recursion()
        {
            var stringWithReturns = "this is\r\na string\n\twith tabs\nand returns";
            var boringString      = "i'm a bore";

            var child1 = new ObjectPrintable
            {
                String = boringString,
                Id     = 17,
            };
            var child2 = new ObjectPrintable
            {
                String = stringWithReturns,
                Id     = 33
            };

            var parent = new ObjectPrintable("Whos your daddy?")
            {
                String     = "Parent",
                Id         = 100,
                Child      = child1,
                Array      = new[] { child1, child2 },
                Dictionary = new Dictionary <int, ObjectPrintable>
                {
                    { child1.Id, child1 },
                    { child2.Id, child2 }
                },
                Hashtable = new Hashtable
                {
                    { child1.Id, child1 },
                    { child2.Id, child2 }
                },
                NVC = new NameValueCollection
                {
                    { "stringWithReturns", stringWithReturns },
                    { "boringString", boringString }
                }
            };

            child1.Parent = parent;
            child2.Parent = parent;
            return(parent);
        }
示例#4
0
        public void SmokeTest_general_use_case_including_recursion()
        {
            var stringWithReturns = "this is\r\na string\n\twith tabs\nand returns";
            var boringString      = "i'm a bore";

            var child1 = new ObjectPrintable
            {
                String = boringString,
                Id     = 17,
            };
            var child2 = new ObjectPrintable
            {
                String = stringWithReturns,
                Id     = 33
            };

            var parent = new ObjectPrintable("Whos your daddy?")
            {
                String     = "Parent",
                Id         = 100,
                Child      = child1,
                Array      = new[] { child1, child2 },
                Dictionary = new Dictionary <int, ObjectPrintable>
                {
                    { child1.Id, child1 },
                    { child2.Id, child2 }
                },
                Hashtable = new Hashtable
                {
                    { child1.Id, child1 },
                    { child2.Id, child2 }
                },
                NVC = new NameValueCollection
                {
                    { "stringWithReturns", stringWithReturns },
                    { "boringString", boringString }
                }
            };

            child1.Parent = parent;
            child2.Parent = parent;

            string expected = @"[ObjectPrintable]: hashcode { $ignore$ }
{
	ToString() : Whos your daddy?
	String : Parent
	Id : 100
	Uri : {NULL}
	Child : [ObjectPrintable]: hashcode { $ignore$ }
	{
		String : i'm a bore
		Id : 17
		Uri : {NULL}
		Child : {NULL}
		Parent : avoid circular loop for this [ObjectPrintable]: hashcode { $ignore$ }
		Array : {NULL}
		Dictionary : {NULL}
		Hashtable : {NULL}
		NVC : {NULL}
	}
	Parent : {NULL}
	Array : [ObjectPrintable[]]: hashcode { $ignore$ }
	{
		[ObjectPrintable]: hashcode { $ignore$ }
		{
			String : i'm a bore
			Id : 17
			Uri : {NULL}
			Child : {NULL}
			Parent : avoid circular loop for this [ObjectPrintable]: hashcode { $ignore$ }
			Array : {NULL}
			Dictionary : {NULL}
			Hashtable : {NULL}
			NVC : {NULL}
		}
		[ObjectPrintable]: hashcode { $ignore$ }
		{
			String : this is
				a string
					with tabs
				and returns
			Id : 33
			Uri : {NULL}
			Child : {NULL}
			Parent : avoid circular loop for this [ObjectPrintable]: hashcode { $ignore$ }
			Array : {NULL}
			Dictionary : {NULL}
			Hashtable : {NULL}
			NVC : {NULL}
		}
	}
	Dictionary : [Dictionary`2]: hashcode { $ignore$ }
	{
		17 : [ObjectPrintable]: hashcode { $ignore$ }
		{
			String : i'm a bore
			Id : 17
			Uri : {NULL}
			Child : {NULL}
			Parent : avoid circular loop for this [ObjectPrintable]: hashcode { $ignore$ }
			Array : {NULL}
			Dictionary : {NULL}
			Hashtable : {NULL}
			NVC : {NULL}
		}
		33 : [ObjectPrintable]: hashcode { $ignore$ }
		{
			String : this is
				a string
					with tabs
				and returns
			Id : 33
			Uri : {NULL}
			Child : {NULL}
			Parent : avoid circular loop for this [ObjectPrintable]: hashcode { $ignore$ }
			Array : {NULL}
			Dictionary : {NULL}
			Hashtable : {NULL}
			NVC : {NULL}
		}
	}
	Hashtable : [Hashtable]: hashcode { $ignore$ }
	{
		17 : [ObjectPrintable]: hashcode { $ignore$ }
		{
			String : i'm a bore
			Id : 17
			Uri : {NULL}
			Child : {NULL}
			Parent : avoid circular loop for this [ObjectPrintable]: hashcode { $ignore$ }
			Array : {NULL}
			Dictionary : {NULL}
			Hashtable : {NULL}
			NVC : {NULL}
		}
		33 : [ObjectPrintable]: hashcode { $ignore$ }
		{
			String : this is
				a string
					with tabs
				and returns
			Id : 33
			Uri : {NULL}
			Child : {NULL}
			Parent : avoid circular loop for this [ObjectPrintable]: hashcode { $ignore$ }
			Array : {NULL}
			Dictionary : {NULL}
			Hashtable : {NULL}
			NVC : {NULL}
		}
	}
	NVC : [NameValueCollection]: hashcode { $ignore$ }
	{
		stringWithReturns : this is
			a string
				with tabs
			and returns
		boringString : i'm a bore
	}
}";

            shouldBeSame(expected, parent);
        }
        private static ObjectPrintable build_general_use_case_including_recursion()
        {
            var stringWithReturns = "this is\r\na string\n\twith tabs\nand returns";
            var boringString = "i'm a bore";

            var child1 = new ObjectPrintable
                {
                    String = boringString,
                    Id = 17,
                };
            var child2 = new ObjectPrintable
                {
                    String = stringWithReturns,
                    Id = 33
                };

            var parent = new ObjectPrintable("Whos your daddy?")
                {
                    String = "Parent",
                    Id = 100,
                    Child = child1,
                    Array = new[] {child1, child2},
                    Dictionary = new Dictionary<int, ObjectPrintable>
                        {
                            {child1.Id, child1},
                            {child2.Id, child2}
                        },
                    Hashtable = new Hashtable
                        {
                            {child1.Id, child1},
                            {child2.Id, child2}
                        },
                    NVC = new NameValueCollection
                        {
                            {"stringWithReturns", stringWithReturns},
                            {"boringString", boringString}
                        }
                };

            child1.Parent = parent;
            child2.Parent = parent;
            return parent;
        }