コード例 #1
0
        public void ReflectionDetails_BadName_ThrowException()
        {
            string      operationName = "Method";
            MyTestClass myTestClass   = new MyTestClass();

            var ex = Assert.Throws <ArgumentNullException>(() => ReflectionDetails.GenerateOperation(myTestClass, operationName));

            StringAssert.Contains("Bad operation name!", ex.Message);
        }
コード例 #2
0
        public void ReflectionDetails_GoodName_CreateOperation()
        {
            string      operationName = "ExtraMethod";
            MyTestClass myTestClass   = new MyTestClass();

            var operation = ReflectionDetails.GenerateOperation(myTestClass, operationName);
            var result    = operation.Name;

            StringAssert.Contains(operationName, operation.Name);
            Assert.NotNull(operation);
            Assert.True(operation.Parameters[0].IsValueTypeOrString);
            Assert.False(operation.Parameters[1].IsValueTypeOrString);
        }