Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
 }