Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
        public void DoNothingIfNoStepInLenientMode()
        {
            var methodMock = new ActionMethodMock(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);

            methodMock.Call();
        }
 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);
 }