コード例 #1
0
        private CheckResult ExecuteAuthorizationCheckers_ArrangeAndAct(bool containsErrror)
        {
            var mockedAuthorizationChecker = MockRepository.GenerateMock <IAuthorizationChecker>();

            mockedAuthorizationChecker
            .Stub(x => x.Check())
            .Return(new CheckResult
            {
                Message       = containsErrror ? "Error" : String.Empty,
                ContainsError = containsErrror
            });

            _checkersFinder
            .Stub(x => x.FindAuthorizationCheckers(Arg <BlankSimpleTestCommand> .Is.Anything))
            .Return(new List <IAuthorizationChecker>
            {
                mockedAuthorizationChecker
            });

            return(_checkersExecuter.ExecuteAuthorizationCheckers(Arg <BlankSimpleTestCommand> .Is.Anything));
        }
コード例 #2
0
        private CheckResult ExecuteAuthorizationCheckers_ArrangeAndAct(bool containsErrror)
        {
            var mockedAuthorizationChecker = new Mock <IAuthorizationChecker>();

            mockedAuthorizationChecker
            .Setup(x => x.Check())
            .Returns(new CheckResult
            {
                Message       = containsErrror ? "Error" : String.Empty,
                ContainsError = containsErrror
            });

            _checkersFinderMock
            .Setup(x => x.FindAuthorizationCheckers(It.IsAny <BlankSimpleTestCommand>()))
            .Returns(new List <IAuthorizationChecker>
            {
                mockedAuthorizationChecker.Object
            });

            return(_checkersExecuter.ExecuteAuthorizationCheckers(It.IsAny <BlankSimpleTestCommand>()));
        }