public void CannotAddToSameRDTwiceTest () { Assembly assembly = typeof (DependencyObject).Assembly; ResourceDictionary rd = new Canvas ().Resources; foreach (string s in CannotAddToSameRDTwice ()) { object o = Activator.CreateInstance (assembly.GetType (s)); rd.Clear (); rd.Add ("1", o); try { rd.Add ("2", o); Assert.Fail ("Type '{0}' should not allow adding to the same RD twice", s); } catch { } } }
public void DoesNotSupportMultipleParentsTest () { Assembly assembly = typeof (DependencyObject).Assembly; ResourceDictionary rd = new Canvas ().Resources; ResourceDictionary rd2 = new Canvas ().Resources; foreach (string s in CannotAddToSameRDTwice ()) { object o = Activator.CreateInstance (assembly.GetType (s)); rd.Clear (); rd2.Clear (); rd.Add ("1", o); try { rd2.Add ("2", o); Assert.Fail ("Type '{0}' should not permit multiple parents", s); } catch { } } }