コード例 #1
0
        public void Filter()
        {
            OurToolboxItem item = new OurToolboxItem();

            Assert.IsNull(item.Filter("AssemblyName", null), "AssemblyName,null");
            // they are "equal" (publicly wise) but have a different hash code
            Assert.AreEqual(typeof(AssemblyName), item.Filter("AssemblyName", an).GetType(), "AssemblyName,an");

            Assert.IsNull(item.Filter("Bitmap", null), "Bitmap,null");
            Assert.AreSame(bitmap, item.Filter("Bitmap", bitmap), "Bitmap,bitmap");

            Assert.AreEqual(String.Empty, item.Filter("DisplayName", null), "DisplayName,null");
            Assert.AreSame(String.Empty, item.Filter("DisplayName", String.Empty), "DisplayName,string");

            Assert.AreEqual(filter, item.Filter("Filter", null), "Filter,null");
            Assert.AreSame(filter, item.Filter("Filter", filter), "Filter,ToolboxItemFilterAttribute[]");

            Assert.AreEqual(String.Empty, item.Filter("TypeName", null), "TypeName,null");
            Assert.AreSame(String.Empty, item.Filter("TypeName", String.Empty), "TypeName,string");

            Assert.IsNull(item.Filter("Company", null), "Company,null");
            Assert.AreSame(String.Empty, item.Filter("Company", String.Empty), "Company,string");

            Assert.AreEqual(null, item.Filter("DependentAssemblies", null), "DependentAssemblies,null");
            // note: not same
            Assert.AreEqual(dependent, item.Filter("DependentAssemblies", filter), "DependentAssemblies,AssemblyName[]");
            Assert.IsFalse(Object.ReferenceEquals(dependent, item.Filter("DependentAssemblies", filter)), "DependentAssemblies,AssemblyName[]/Reference");

            Assert.IsNull(item.Filter("Description", null), "Description,null");
            Assert.AreSame(String.Empty, item.Filter("Description", String.Empty), "Description,string");

            Assert.IsTrue((bool)item.Filter("IsTransient", true), "IsTransient,true");
            Assert.IsFalse((bool)item.Filter("IsTransient", false), "IsTransient,false");
        }
コード例 #2
0
        public void ValidatePropertyType()
        {
            OurToolboxItem item = new OurToolboxItem();

            item._ValidatePropertyType("IsTransient", true, typeof(bool), false);
            item._ValidatePropertyType("IsTransient", String.Empty, typeof(string), false);
        }
コード例 #3
0
ファイル: TestToolboxItem.cs プロジェクト: pmq20/mono_forked
        public void TestCheckUnlocked1()
        {
            OurToolboxItem item = new OurToolboxItem();

            item.Lock();
            item._CheckUnlocked();
        }
コード例 #4
0
 public void ValidatePropertyType_DontAllowNull()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         OurToolboxItem item = new OurToolboxItem();
         item._ValidatePropertyType("IsTransient", null, typeof(bool), false);
     });
 }
コード例 #5
0
 public void ValidatePropertyType_Type_Null()
 {
     Assert.Throws <NullReferenceException>(() =>
     {
         OurToolboxItem item = new OurToolboxItem();
         item._ValidatePropertyType("IsTransient", true, null, false);
     });
 }
コード例 #6
0
 public void ValidatePropertyType_IsTransient_WrongType()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         OurToolboxItem item = new OurToolboxItem();
         item._ValidatePropertyType("IsTransient", new object(), typeof(bool), false);
     });
 }
コード例 #7
0
 public void ValidatePropertyValue_Description_WrongType()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         OurToolboxItem item = new OurToolboxItem();
         item._ValidatePropertyValue("Description", false);
     });
 }
コード例 #8
0
 public void TestCheckUnlocked1()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         OurToolboxItem item = new OurToolboxItem();
         item.Lock();
         item._CheckUnlocked();
     });
 }
コード例 #9
0
        public void ValidatePropertyValue()
        {
            OurToolboxItem item = new OurToolboxItem();
            object         o    = new object();

            Assert.IsNull(item._ValidatePropertyValue(null, null), "null,null");
            Assert.AreSame(o, item._ValidatePropertyValue(null, o), "null,object");
            Assert.IsNull(item._ValidatePropertyValue("string", null), "string,null");
            Assert.AreSame(o, item._ValidatePropertyValue("string", o), "string,object");

            Assert.IsNull(item._ValidatePropertyValue("AssemblyName", null), "AssemblyName,null");
            Assert.AreSame(an, item._ValidatePropertyValue("AssemblyName", an), "AssemblyName,an");

            Assert.IsNull(item._ValidatePropertyValue("Bitmap", null), "Bitmap,null");
            Assert.AreSame(bitmap, item._ValidatePropertyValue("Bitmap", bitmap), "Bitmap,bitmap");

            Assert.AreEqual(String.Empty, item._ValidatePropertyValue("DisplayName", null), "DisplayName,null");
            Assert.AreSame(String.Empty, item._ValidatePropertyValue("DisplayName", String.Empty), "DisplayName,string");

            Assert.AreEqual(filter, item._ValidatePropertyValue("Filter", null), "Filter,null");
            Assert.AreEqual(filter, item._ValidatePropertyValue("Filter", filter), "Filter,ToolboxItemFilterAttribute[]");
            //Assert.IsFalse (Object.ReferenceEquals (filter, item._ValidatePropertyValue ("Filter", filter)), "Filter,ToolboxItemFilterAttribute[]/Reference");

            Assert.AreEqual(String.Empty, item._ValidatePropertyValue("TypeName", null), "TypeName,null");
            Assert.AreSame(String.Empty, item._ValidatePropertyValue("TypeName", String.Empty), "TypeName,string");

            Assert.AreEqual(String.Empty, item._ValidatePropertyValue("Company", null), "Company,null");
            Assert.AreSame(String.Empty, item._ValidatePropertyValue("Company", String.Empty), "Company,string");

            Assert.AreEqual(null, item._ValidatePropertyValue("DependentAssemblies", null), "DependentAssemblies,null");
            Assert.AreEqual(dependent, item._ValidatePropertyValue("DependentAssemblies", dependent), "DependentAssemblies,AssemblyName[]");
            Assert.IsTrue(Object.ReferenceEquals(dependent, item._ValidatePropertyValue("DependentAssemblies", dependent)), "DependentAssemblies,AssemblyName[]/Reference");

            Assert.AreEqual(String.Empty, item._ValidatePropertyValue("Description", null), "Description,null");
            Assert.AreSame(String.Empty, item._ValidatePropertyValue("Description", String.Empty), "Description,string");

            Assert.IsTrue((bool)item._ValidatePropertyValue("IsTransient", true), "IsTransient,true");
            Assert.IsFalse((bool)item._ValidatePropertyValue("IsTransient", false), "IsTransient,false");
        }
コード例 #10
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyType_DontAllowNull ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._ValidatePropertyType ("IsTransient", null, typeof (bool), false);
		}
コード例 #11
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyType_Type_Null ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._ValidatePropertyType ("IsTransient", true, null, false);
		}
コード例 #12
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyType_IsTransient_WrongType ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._ValidatePropertyType ("IsTransient", new object (), typeof (bool), false);
		}
コード例 #13
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void Filter ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			Assert.IsNull (item.Filter ("AssemblyName", null), "AssemblyName,null");
			// they are "equal" (publicly wise) but have a different hash code
			Assert.AreEqual (typeof (AssemblyName), item.Filter ("AssemblyName", an).GetType (), "AssemblyName,an");

			Assert.IsNull (item.Filter ("Bitmap", null), "Bitmap,null");
			Assert.AreSame (bitmap, item.Filter ("Bitmap", bitmap), "Bitmap,bitmap");

			Assert.AreEqual (String.Empty, item.Filter ("DisplayName", null), "DisplayName,null");
			Assert.AreSame (String.Empty, item.Filter ("DisplayName", String.Empty), "DisplayName,string");

			Assert.AreEqual (filter, item.Filter ("Filter", null), "Filter,null");
			Assert.AreSame (filter, item.Filter ("Filter", filter), "Filter,ToolboxItemFilterAttribute[]");

			Assert.AreEqual (String.Empty, item.Filter ("TypeName", null), "TypeName,null");
			Assert.AreSame (String.Empty, item.Filter ("TypeName", String.Empty), "TypeName,string");

			Assert.IsNull (item.Filter ("Company", null), "Company,null");
			Assert.AreSame (String.Empty, item.Filter ("Company", String.Empty), "Company,string");

			Assert.AreEqual (null, item.Filter ("DependentAssemblies", null), "DependentAssemblies,null");
			// note: not same
			Assert.AreEqual (dependent, item.Filter ("DependentAssemblies", filter), "DependentAssemblies,AssemblyName[]");
			Assert.IsFalse (Object.ReferenceEquals (dependent, item.Filter ("DependentAssemblies", filter)), "DependentAssemblies,AssemblyName[]/Reference");

			Assert.IsNull (item.Filter ("Description", null), "Description,null");
			Assert.AreSame (String.Empty, item.Filter ("Description", String.Empty), "Description,string");

			Assert.IsTrue ((bool) item.Filter ("IsTransient", true), "IsTransient,true");
			Assert.IsFalse ((bool) item.Filter ("IsTransient", false), "IsTransient,false");
		}
コード例 #14
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyType ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._ValidatePropertyType ("IsTransient", true, typeof (bool), false);
			item._ValidatePropertyType ("IsTransient", String.Empty, typeof (string), false);
		}
コード例 #15
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyValue_Filter_WrongType ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._ValidatePropertyValue ("Filter", false);
		}
コード例 #16
0
        public void GetType_Null_Null_String_False()
        {
            OurToolboxItem item = new OurToolboxItem();

            Assert.IsNull(item._GetType(null, null, "string", false), "GetType");
        }
コード例 #17
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyValue_Company_WrongType ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._ValidatePropertyValue ("Company", false);
		}
コード例 #18
0
ファイル: TestToolboxItem.cs プロジェクト: pmq20/mono_forked
        public void ValidatePropertyValue_Filter_WrongType()
        {
            OurToolboxItem item = new OurToolboxItem();

            item._ValidatePropertyValue("Filter", false);
        }
コード例 #19
0
ファイル: TestToolboxItem.cs プロジェクト: pmq20/mono_forked
        public void ValidatePropertyValue_TypeName_WrongType()
        {
            OurToolboxItem item = new OurToolboxItem();

            item._ValidatePropertyValue("TypeName", false);
        }
コード例 #20
0
ファイル: TestToolboxItem.cs プロジェクト: pmq20/mono_forked
        public void ValidatePropertyType_Type_Null()
        {
            OurToolboxItem item = new OurToolboxItem();

            item._ValidatePropertyType("IsTransient", true, null, false);
        }
コード例 #21
0
ファイル: TestToolboxItem.cs プロジェクト: pmq20/mono_forked
        public void ValidatePropertyValue_Company_WrongType()
        {
            OurToolboxItem item = new OurToolboxItem();

            item._ValidatePropertyValue("Company", false);
        }
コード例 #22
0
ファイル: TestToolboxItem.cs プロジェクト: pmq20/mono_forked
        public void ValidatePropertyType_IsTransient_WrongType()
        {
            OurToolboxItem item = new OurToolboxItem();

            item._ValidatePropertyType("IsTransient", new object(), typeof(bool), false);
        }
コード例 #23
0
ファイル: TestToolboxItem.cs プロジェクト: pmq20/mono_forked
        public void ValidatePropertyType_DontAllowNull()
        {
            OurToolboxItem item = new OurToolboxItem();

            item._ValidatePropertyType("IsTransient", null, typeof(bool), false);
        }
コード例 #24
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyValue ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			object o = new object ();
			Assert.IsNull (item._ValidatePropertyValue (null, null), "null,null");
			Assert.AreSame (o, item._ValidatePropertyValue (null, o), "null,object");
			Assert.IsNull (item._ValidatePropertyValue ("string", null), "string,null");
			Assert.AreSame (o, item._ValidatePropertyValue ("string", o), "string,object");

			Assert.IsNull (item._ValidatePropertyValue ("AssemblyName", null), "AssemblyName,null");
			Assert.AreSame (an, item._ValidatePropertyValue ("AssemblyName", an), "AssemblyName,an");

			Assert.IsNull (item._ValidatePropertyValue ("Bitmap", null), "Bitmap,null");
			Assert.AreSame (bitmap, item._ValidatePropertyValue ("Bitmap", bitmap), "Bitmap,bitmap");

			Assert.AreEqual (String.Empty, item._ValidatePropertyValue ("DisplayName", null), "DisplayName,null");
			Assert.AreSame (String.Empty, item._ValidatePropertyValue ("DisplayName", String.Empty), "DisplayName,string");

			Assert.AreEqual (filter, item._ValidatePropertyValue ("Filter", null), "Filter,null");
			Assert.AreEqual (filter, item._ValidatePropertyValue ("Filter", filter), "Filter,ToolboxItemFilterAttribute[]");
			//Assert.IsFalse (Object.ReferenceEquals (filter, item._ValidatePropertyValue ("Filter", filter)), "Filter,ToolboxItemFilterAttribute[]/Reference");

			Assert.AreEqual (String.Empty, item._ValidatePropertyValue ("TypeName", null), "TypeName,null");
			Assert.AreSame (String.Empty, item._ValidatePropertyValue ("TypeName", String.Empty), "TypeName,string");

			Assert.AreEqual (String.Empty, item._ValidatePropertyValue ("Company", null), "Company,null");
			Assert.AreSame (String.Empty, item._ValidatePropertyValue ("Company", String.Empty), "Company,string");

			Assert.AreEqual (null, item._ValidatePropertyValue ("DependentAssemblies", null), "DependentAssemblies,null");
			Assert.AreEqual (dependent, item._ValidatePropertyValue ("DependentAssemblies", dependent), "DependentAssemblies,AssemblyName[]");
			Assert.IsTrue (Object.ReferenceEquals (dependent, item._ValidatePropertyValue ("DependentAssemblies", dependent)), "DependentAssemblies,AssemblyName[]/Reference");

			Assert.AreEqual (String.Empty, item._ValidatePropertyValue ("Description", null), "Description,null");
			Assert.AreSame (String.Empty, item._ValidatePropertyValue ("Description", String.Empty), "Description,string");

			Assert.IsTrue ((bool)item._ValidatePropertyValue ("IsTransient", true), "IsTransient,true");
			Assert.IsFalse ((bool)item._ValidatePropertyValue ("IsTransient", false), "IsTransient,false");
		}
コード例 #25
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void TestCheckUnlocked2 ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._CheckUnlocked ();
		}
コード例 #26
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyValue_Bitmap_WrongType ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._ValidatePropertyValue ("Bitmap", false);
		}
コード例 #27
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void GetType_Null_Null_String_False ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			Assert.IsNull (item._GetType (null, null, "string", false), "GetType");
		}
コード例 #28
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyValue_TypeName_WrongType ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._ValidatePropertyValue ("TypeName", false);
		}
コード例 #29
0
ファイル: TestToolboxItem.cs プロジェクト: pmq20/mono_forked
        public void ValidatePropertyValue_Description_WrongType()
        {
            OurToolboxItem item = new OurToolboxItem();

            item._ValidatePropertyValue("Description", false);
        }
コード例 #30
0
ファイル: TestToolboxItem.cs プロジェクト: Profit0004/mono
		public void ValidatePropertyValue_Description_WrongType ()
		{
			OurToolboxItem item = new OurToolboxItem ();
			item._ValidatePropertyValue ("Description", false);
		}
コード例 #31
0
ファイル: TestToolboxItem.cs プロジェクト: pmq20/mono_forked
        public void ValidatePropertyValue_Bitmap_WrongType()
        {
            OurToolboxItem item = new OurToolboxItem();

            item._ValidatePropertyValue("Bitmap", false);
        }