コード例 #1
0
        public void ExtractMethodName_ReturnsMethodName_WithArgs()
        {
            var model = new TestClass();

             Assert.AreEqual( "TestMethod1Arg", ClassHelper.ExtractMethodName( () => model.TestMethod1Arg( "testit" ) ) );
        }
コード例 #2
0
        public void ExtractProperyName_ThrowsException_WhenPassedMemberIsMethod()
        {
            var model = new TestClass();

             try
             {
            ClassHelper.ExtractPropertyName( () => model.TestMethod1Arg( "test" ) );
             }
             catch (Exception e)
             {
            var argEx = e as ArgumentException;
            Assert.IsNotNull( argEx );
            Assert.AreEqual( "expression", argEx.ParamName );
            return;
             }
             Assert.Fail( "Should have thrown exception" );
        }