コード例 #1
0
ファイル: PostActionTests.cs プロジェクト: wshcdr/sutekishop
        public void GetExpressionDetails_should_work()
        {
            var entity = new TestEntity {
                Id = 4
            };
            Expression <Action <TestController> > action = c => c.DoSomething(entity);

            var expressionDetails = PostAction <TestController> .GetExpressionDetails(action);

            expressionDetails.MethodName.ShouldEqual("DoSomething");
            expressionDetails.IdValue.ShouldEqual(4);
        }
コード例 #2
0
ファイル: PostActionTests.cs プロジェクト: wshcdr/sutekishop
        public void GetExpressionDetails_should_work_on_an_enumerated_type()
        {
            var entities = new List <TestEntity>
            {
                new TestEntity {
                    Id = 3
                },
                new TestEntity {
                    Id = 5
                },
                new TestEntity {
                    Id = 7
                }
            };

            foreach (var entity in entities)
            {
                Expression <Action <TestController> > action = c => c.DoSomething(entity);
                var expressionDetails = PostAction <TestController> .GetExpressionDetails(action);

                expressionDetails.MethodName.ShouldEqual("DoSomething");
                expressionDetails.IdValue.ShouldEqual(entity.Id);
            }
        }