Esempio n. 1
0
        public void TestSystem()
        {
            SerializableAttribute sa = new SerializableAttribute();
            Assert(sa.GetType().IsSubclassOf(typeof(System.Attribute)));
            NonSerializedAttribute nsa = new NonSerializedAttribute();
            Assert(nsa.GetType().IsSubclassOf(typeof(System.Attribute)));

            //just make sure the definition is in the right place
            System.Runtime.Serialization.ISerializable iSerial = null;
            AreEqual(iSerial, null);

            AreEqual(StringSplitOptions.None.ToString("D"), "0");
            AreEqual(StringSplitOptions.RemoveEmptyEntries.ToString("D"), "1");

            AreEqual(ConsoleColor.Black.ToString("D"), "0");
            AreEqual(ConsoleColor.DarkBlue.ToString("D"), "1");
            AreEqual(ConsoleColor.DarkGreen.ToString("D"), "2");
            AreEqual(ConsoleColor.DarkCyan.ToString("D"), "3");
            AreEqual(ConsoleColor.DarkRed.ToString("D"), "4");
            AreEqual(ConsoleColor.DarkMagenta.ToString("D"), "5");
            AreEqual(ConsoleColor.DarkYellow.ToString("D"), "6");
            AreEqual(ConsoleColor.Gray.ToString("D"), "7");
            AreEqual(ConsoleColor.DarkGray.ToString("D"), "8");
            AreEqual(ConsoleColor.Blue.ToString("D"), "9");
            AreEqual(ConsoleColor.Green.ToString("D"), "10");
            AreEqual(ConsoleColor.Cyan.ToString("D"), "11");
            AreEqual(ConsoleColor.Red.ToString("D"), "12");
            AreEqual(ConsoleColor.Magenta.ToString("D"), "13");
            AreEqual(ConsoleColor.Yellow.ToString("D"), "14");
            AreEqual(ConsoleColor.White.ToString("D"), "15");
        }
		public void Attributes ()
		{
			Attribute[] attributes = new Attribute [3];
			Attribute[] attributes2;

			attributes[0] = new ObsoleteAttribute ();
			attributes[1] = new ObsoleteAttribute ();
			attributes[2] = new NonSerializedAttribute ();
			PropertyMetadata pm = new PropertyMetadata (attributes);
			attributes2 = pm.GetAttributes ();
			Assert.AreEqual (3, attributes2.Length, "C9#1");
			Assert.AreEqual (attributes[0], attributes2[0], "C9#2");
			Assert.AreEqual (attributes[1], attributes2[1], "C9#3");
			Assert.AreEqual (attributes[2], attributes2[2], "C9#4");

			attributes2 = pm.GetAttributes (typeof (NonSerializedAttribute));
			Assert.AreEqual (1, attributes2.Length, "C9#5");
			Assert.AreEqual (attributes[2], attributes2[0], "C9#6");

			attributes2 = pm.GetAttributes (typeof (ObsoleteAttribute));
			Assert.AreEqual (2, attributes2.Length, "C9#7");
			Assert.AreEqual (attributes[0], attributes2[0], "C9#8");
			Assert.AreEqual (attributes[1], attributes2[1], "C9#9");

			attributes2 = pm.GetAttributes (typeof (ParamArrayAttribute));
			Assert.AreEqual (0, attributes2.Length, "C9#10");
		}