Exemple #1
0
 public void Given_IInterfaceWithManyBases_GetPropertyByName()
 {
     Assert.IsNotNull(
         typeof(IInterfaceWithManyBases).GetProperty(
             ObjectDescriber.GetName((IInterfaceWithManyBases _) => _.A),
             true));
     Assert.IsNotNull(
         typeof(IInterfaceWithManyBases).GetProperty(
             ObjectDescriber.GetName((IInterfaceWithManyBases _) => _.B),
             true));
     Assert.IsNotNull(
         typeof(IInterfaceWithManyBases).GetProperty(
             ObjectDescriber.GetName((IInterfaceWithManyBases _) => _.C),
             true));
     Assert.IsNotNull(
         typeof(IInterfaceWithManyBases).GetProperty(
             ObjectDescriber.GetName((IInterfaceWithManyBases _) => _.D),
             true));
     Assert.IsNotNull(
         typeof(IInterfaceWithManyBases).GetProperty(
             ObjectDescriber.GetName((IInterfaceWithManyBases _) => _.E),
             true));
     Assert.IsNotNull(
         typeof(IInterfaceWithManyBases).GetProperty(
             ObjectDescriber.GetName((IInterfaceWithManyBases _) => _.F),
             false));
 }
 public void TestGetNameForStaticProperty()
 {
     Assert.AreEqual("SomeStaticProperty", ObjectDescriber.GetName(() => Test.SomeStaticProperty));
 }
 public void TestGetNameForStaticFunction()
 {
     Assert.AreEqual("SomeStaticFunction", ObjectDescriber.GetName(() => Test.SomeStaticFunction()));
 }
 public void TestGetNameForProperty()
 {
     Assert.AreEqual("SomeProperty", ObjectDescriber.GetName((Test _) => _.SomeProperty));
 }
 public void TestGetNameForFunction()
 {
     Assert.AreEqual("SomeFunction", ObjectDescriber.GetName((Test _) => _.SomeFunction()));
 }
 public void TestGetNameForComplexExpressionFailsProperly()
 {
     Assert.Throws <NotSupportedException>(
         () => ObjectDescriber.GetName(() => Test.SomeStaticProperty + "Hello"));
 }