Beispiel #1
0
        protected override void beforeEach()
        {
            var source = "<h1>hi</h1>";
            var viewId = Guid.NewGuid();

            _service         = MockFor <IViewModifierService <IFubuRazorView> >();
            _templateFactory = MockFor <ITemplateFactory>();
            var fileSystem = MockFor <IFileSystem>();

            fileSystem.Expect(x => x.ReadStringFromFile(null)).Return(source);

            var template = MockFor <IRazorTemplate>();

            template.Expect(x => x.GeneratedViewId).Return(viewId);
            var descriptor = new ViewDescriptor <IRazorTemplate>(template);

            Services.Inject(descriptor);

            Services.Inject(_templateFactory);
            _entryView   = MockRepository.GenerateMock <StubView>();
            _serviceView = MockRepository.GenerateMock <IFubuRazorView>();

            _templateFactory.Expect(x => x.GetView(Arg.Is(descriptor))).Return(_entryView);
            _service.Expect(x => x.Modify(_entryView)).Return(_serviceView);
        }