public void ViewManagerCreateView()
        {
            #region Mock intialization

            DynamicMock useCase = new DynamicMock(typeof(IUseCase));
            DynamicMock engine = new DynamicMock(typeof(IRegexEngine));
            DynamicMock view = new DynamicMock(typeof(IRegexView));

            IRegexView viewMockInstance = (IRegexView)view.MockInstance;
            IUseCase useCaseMockInstance = (IUseCase)useCase.MockInstance;
            IRegexEngine engineMockInstance = (IRegexEngine)engine.MockInstance;

            #endregion

            useCase.ExpectAndReturn("CreateNewView", viewMockInstance);
            useCase.ExpectAndReturn("CreateNewEngine", engineMockInstance);
            engine.Expect("AttachView", withSameObjectAs(viewMockInstance));
            view.Expect("Init", withSameObjectAs(engineMockInstance));

            ViewManager factory = new ViewManager();
            IRegexView newView = factory.CreateView(useCaseMockInstance);

            useCase.Verify();
            engine.Verify();
            view.Verify();

            Assert.AreSame(newView, viewMockInstance,"Returned view is not the same instance as expected");
        }
        public void ViewManagerCreateView()
        {
            DynamicMock useCase = new DynamicMock(typeof(IUseCase));
            IUseCase useCaseMockInstance = (IUseCase)useCase.MockInstance;

            IRegexEngine engine = new DotNetRegexEngine();
            IRegexView view = new ReplaceView();

            useCase.ExpectAndReturn("CreateNewView", view);
            useCase.ExpectAndReturn("CreateNewEngine", engine);

            ViewManager factory = new ViewManager();
            IRegexView newView = factory.CreateView(useCaseMockInstance);
            Form frm = (Form)newView;
            frm.ShowDialog();
        }
 public void Create()
 {
     ViewManager factory = new ViewManager();
     Assert.IsNotNull(factory);
 }