コード例 #1
0
        public void ThrowIfNoStepInVeryStrictMode()
        {
            var methodMock = new ActionMethodMock(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.VeryStrict);
            var ex         = Assert.Throws <MockMissingException>(() => methodMock.Call());

            Assert.Equal(MockType.Method, ex.MemberType);
        }
コード例 #2
0
        public void DoNothingIfClearedInLenientMode()
        {
            var methodMock = new ActionMethodMock(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            var nextStep   = NextStepFor(methodMock);

            methodMock.Clear();
            methodMock.Call();
            Assert.Equal(0, nextStep.Count);
        }
コード例 #3
0
        public void SendMockInformationToStep()
        {
            var methodMock = new ActionMethodMock(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            var nextStep   = NextStepFor(methodMock);

            methodMock.Call();

            Assert.Equal(1, nextStep.Count);
            Assert.Same(methodMock, nextStep.LastMockInfo);
        }
コード例 #4
0
        public void ThrowIfClearedInVeryStrictMode()
        {
            var methodMock = new ActionMethodMock(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.VeryStrict);
            var nextStep   = NextStepFor(methodMock);

            methodMock.Clear();
            var ex = Assert.Throws <MockMissingException>(() => methodMock.Call());

            Assert.Equal(MockType.Method, ex.MemberType);
            Assert.Equal(0, nextStep.Count);
        }
コード例 #5
0
        public void SendMockInformationAndParametersToStep()
        {
            var actionMock = new ActionMethodMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            var nextStep   = NextStepFor(actionMock);

            actionMock.Call(5);

            Assert.Equal(1, nextStep.Count);
            Assert.Same(actionMock, nextStep.LastMockInfo);
            Assert.Equal(5, nextStep.LastParam);
        }
コード例 #6
0
        public void DoNothingIfNoStepInLenientMode()
        {
            var methodMock = new ActionMethodMock(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);

            methodMock.Call();
        }
コード例 #7
0
 public ActionMethodMockSetNextStepTests()
 {
     _parameterLessActionMock = new ActionMethodMock(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
     _actionMock = new ActionMethodMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
 }