Exemplo n.º 1
0
        public void CreateFromAction_AddsToCollection()
        {
            var methodCallInfo = TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine());
            Expression<Action> expression = ReflectionUtility.GetExpression(() => Console.WriteLine());

            _expressionHelperMock
                .Setup(helper => helper.GetMethod(expression))
                .Returns(methodCallInfo);

            var subject = new SetupManager(_expressionHelperMock.Object);
            ISetup setup = subject.Create(expression);

            Assert.IsTrue(subject.Cast<ISetup>().SequenceEqual(new[] { setup }));
        }
Exemplo n.º 2
0
        public void CreateFromAction_AddsToCollection()
        {
            var methodCallInfo             = TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine());
            Expression <Action> expression = ReflectionUtility.GetExpression(() => Console.WriteLine());

            _expressionHelperMock
            .Setup(helper => helper.GetMethod(expression))
            .Returns(methodCallInfo);

            var    subject = new SetupManager(_expressionHelperMock.Object);
            ISetup setup   = subject.Create(expression);

            Assert.IsTrue(subject.Cast <ISetup>().SequenceEqual(new[] { setup }));
        }