Пример #1
0
        public void ThrowIfNoStepInVeryStrictMode()
        {
            var methodMock = new FuncMethodMock <string>(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 ReturnDefaultIfNoStepInLenientMode()
        {
            var    methodMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            string result     = methodMock.Call();

            Assert.Null(result);
        }
Пример #3
0
        public void ThrowIfClearedInVeryStrictMode()
        {
            var methodMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.VeryStrict);
            var nextStep   = NextStepFor(methodMock, "5");

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

            Assert.Equal(MockType.Method, ex.MemberType);
            Assert.Equal(0, nextStep.Count);
        }
Пример #4
0
        public void ReturnDefaultIfClearedInLenientMode()
        {
            var methodMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            var nextStep   = NextStepFor(methodMock, "5");

            methodMock.Clear();
            string result = methodMock.Call();

            Assert.Equal(0, nextStep.Count);
            Assert.Null(result);
        }
Пример #5
0
        public void SendMockInformationToStepAndGetResultBack()
        {
            var methodMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            var nextStep   = NextStepFor(methodMock, "5");

            string result = methodMock.Call();

            Assert.Equal(1, nextStep.Count);
            Assert.Same(methodMock, nextStep.LastMockInfo);
            Assert.Equal("5", result);
        }
 public FuncMethodMockSetNextStepTests()
 {
     _parameterLessFuncMock =
         new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
     _funcMock = new FuncMethodMock <int, string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
 }