示例#1
0
        public void SetUp()
        {
            _currentItem         = new Mock <IItem>();
            _currentItemTemplate = new Mock <ITemplateItem>();
            _translate           = new Mock <ITranslate>();

            _controlerValidator = new Mock <IControllerValidator>();
            _log = new Mock <ILog>();

            _log.Setup(l => l.Warn(It.IsAny <string>(), It.IsAny <object>()))
            .Callback <string, object>((m, o) => _warningMessage = m);

            _translate.Setup(x => x.Text(It.IsAny <string>())).Returns((string s) => s.ToLower());

            _currentItem.SetupGet(x => x.Template).Returns(_currentItemTemplate.Object);

            _currentItemTemplate.SetupGet(x => x.ID).Returns(Constants.Templates.ControllerRenderingWithValidation);

            _validator = new TestControllerRenderingValidator(_controlerValidator.Object, _log.Object)
            {
                Item      = _currentItem.Object,
                Translate = _translate.Object,
                GetText   = s => s
            };
        }
        public void SetUp()
        {
            _currentItem = new Mock<IItem>();
            _currentItemTemplate = new Mock<ITemplateItem>();
            _translate = new Mock<ITranslate>();

            _controlerValidator = new Mock<IControllerValidator>();
            _log = new Mock<ILog>();

            _log.Setup(l => l.Warn(It.IsAny<string>(), It.IsAny<object>()))
                .Callback<string, object>((m, o) => _warningMessage = m);

            _translate.Setup(x => x.Text(It.IsAny<string>())).Returns((string s) => s.ToLower());

            _currentItem.SetupGet(x => x.Template).Returns(_currentItemTemplate.Object);

            _currentItemTemplate.SetupGet(x => x.ID).Returns(Constants.Templates.ControllerRenderingWithValidation);

            _validator = new TestControllerRenderingValidator(_controlerValidator.Object, _log.Object)
                             {
                                 Item = _currentItem.Object,
                                 Translate = _translate.Object,
                                 GetText = s => s
                             };
        }