Пример #1
0
        public void Serialization()
        {
            Action <object, bool> del = (source, binary) =>
            {
                var mode = binary ? "binary" : "text/soap";
                ConsoleEx.WriteLine("\n- Source ({0}): {1}", mode, source);

                var path = "c:\\temp\\data"; path += binary ? ".bin" : ".xml";
                path.PathSerialize(source, binary);

                var temp = path.PathDeserialize(binary);
                ConsoleEx.WriteLine("- Created ({0}): {1}", mode, temp);

                var result = source.IsEquivalentTo(temp);
                Assert.IsTrue(result,
                              "With mode '{0}' source '{1}' and deserialized '{2}' are not equivalent."
                              .FormatWith(mode, source.Sketch(), temp.Sketch()));
            };

            var obj = new Concrete.Parameter()
            {
                Name = "@1", Value = "James Bond"
            };

            del(obj, true);
            del(obj, false);
        }
Пример #2
0
		public void Cloning()
		{
			Action<object> del = (source) =>
			{
				ConsoleEx.WriteLine("\n- Source: {0}", source);

				var temp = ((ICloneable)source).Clone();
				ConsoleEx.WriteLine("- Cloned: {0}", temp);

				Assert.IsTrue(source.IsEquivalentTo(temp),
					"Source '{0}' and cloned '{1}' are not equivalent."
					.FormatWith(source, temp));
			};

			var obj = new Concrete.Parameter() { Name = "@1", Value = "James Bond" };
			del(obj);
		}
Пример #3
0
        public void Cloning()
        {
            Action <object> del = (source) =>
            {
                ConsoleEx.WriteLine("\n- Source: {0}", source);

                var temp = ((ICloneable)source).Clone();
                ConsoleEx.WriteLine("- Cloned: {0}", temp);

                Assert.IsTrue(source.IsEquivalentTo(temp),
                              "Source '{0}' and cloned '{1}' are not equivalent."
                              .FormatWith(source, temp));
            };

            var obj = new Concrete.Parameter()
            {
                Name = "@1", Value = "James Bond"
            };

            del(obj);
        }
Пример #4
0
		public void Serialization()
		{
			Action<object, bool> del = (source, binary) =>
			{
				var mode = binary ? "binary" : "text/soap";
				ConsoleEx.WriteLine("\n- Source ({0}): {1}", mode, source);

				var path = "c:\\temp\\data"; path += binary ? ".bin" : ".xml";
				path.PathSerialize(source, binary);

				var temp = path.PathDeserialize(binary);
				ConsoleEx.WriteLine("- Created ({0}): {1}", mode, temp);

				var result = source.IsEquivalentTo(temp);
				Assert.IsTrue(result,
					"With mode '{0}' source '{1}' and deserialized '{2}' are not equivalent."
					.FormatWith(mode, source.Sketch(), temp.Sketch()));
			};

			var obj = new Concrete.Parameter() { Name = "@1", Value = "James Bond" };
			del(obj, true);
			del(obj, false);
		}