Пример #1
0
        public void Sample_MethodWithLambda()
        {
            dynamic isolated = new DynamicMock();

            isolated.Execute(_, _, If(a => a > 0m), _).Returns(42);
            isolated.Execute(_, _, If(a => a < 0m), _).Returns(18);

            ISampleInterface result = isolated;

            var actual1 = result.Execute(1, "", 10m, null);
            var actual2 = result.Execute(1, "", -5m, null);

            Assert.AreEqual(42, actual1);
            Assert.AreEqual(18, actual2);
        }
Пример #2
0
        public void Sample_MethodWithGround()
        {
            dynamic isolated = new DynamicMock();

            isolated.Execute(_, _, _, _).Returns(42);

            ISampleInterface result = isolated;

            var actual = result.Execute(1, "", 10m, null);

            Assert.AreEqual(42, actual);
        }