Exemplo n.º 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);
        }
Exemplo n.º 2
0
        protected override void beforeEach()
        {
            var source = "<h1>hi</h1>";
            var viewId = Guid.NewGuid();

            _service         = MockFor <IViewModifierService <IFubuRazorView> >();
            _templateService = MockFor <ITemplateService>();
            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 <IFubuTemplateService>(new FubuTemplateService(new TemplateRegistry <IRazorTemplate>(), _templateService, fileSystem));
            _entryView   = MockRepository.GenerateMock <StubView>();
            _serviceView = MockRepository.GenerateMock <IFubuRazorView>();

            _templateService.Expect(x => x.HasTemplate(Arg.Is(viewId.ToString()))).Return(false);
            _templateService.Expect(x => x.GetTemplate(Arg.Is(source), Arg.Is(viewId.ToString()))).Return(_entryView);
            _service.Expect(x => x.Modify(_entryView)).Return(_serviceView);
        }
Exemplo n.º 3
0
        protected override void beforeEach()
        {
            _service     = MockFor <IViewModifierService>();
            _entrySource = MockFor <IViewEntrySource>();

            _sourceEntry = MockRepository.GenerateMock <ISparkViewEntry>();
            _entryView   = MockRepository.GenerateMock <FubuSparkView>();
            _serviceView = MockRepository.GenerateMock <IFubuSparkView>();

            _sourceEntry.Expect(x => x.CreateInstance()).Return(_entryView);
            _service.Expect(x => x.Modify(_entryView)).Return(_serviceView);
        }