public void Initialize() { var context = new Mock <IContextAware>(); var progress = new Mock <ITrackSteppingProgress>(); var aggregator = new Mock <IEventAggregator>(); Func <string, IDisposable> func = s => new MockDisposable(); var proxyDataset = CreateDataset(0, new List <Mock <IProxyDataset> >()); var project = new Mock <IProject>(); { project.Setup(p => p.BaseDataset()) .Returns(proxyDataset.Object); } var projectFacade = new ProjectFacade(project.Object); var projectLink = new Mock <ILinkToProjects>(); { projectLink.Setup(p => p.ActiveProject()) .Returns(projectFacade); } var view = new Mock <IDatasetGraphView>(); { view.SetupSet(v => v.Model = It.IsAny <DatasetGraphModel>()) .Verifiable(); } var parameter = new DatasetGraphParameter(context.Object); var container = new Mock <IDependencyInjectionProxy>(); { container.Setup(c => c.Resolve <IContextAware>()) .Returns(context.Object); container.Setup(c => c.Resolve <ILinkToProjects>()) .Returns(projectLink.Object); container.Setup(c => c.Resolve <ITrackSteppingProgress>()) .Returns(progress.Object); container.Setup(c => c.Resolve <IEventAggregator>()) .Returns(aggregator.Object); container.Setup(c => c.Resolve <Func <string, IDisposable> >()) .Returns(func); } var presenter = new DatasetGraphPresenter(container.Object); ((IPresenter)presenter).Initialize(view.Object, parameter); Assert.AreSame(view.Object, presenter.View); Assert.AreSame(parameter, presenter.Parameter); view.VerifySet(v => v.Model = It.IsAny <DatasetGraphModel>(), Times.Once()); }
public void Initialize() { var context = new Mock<IContextAware>(); var progress = new Mock<ITrackSteppingProgress>(); var aggregator = new Mock<IEventAggregator>(); Func<string, IDisposable> func = s => new MockDisposable(); var proxyDataset = CreateDataset(0, new List<Mock<IProxyDataset>>()); var project = new Mock<IProject>(); { project.Setup(p => p.BaseDataset()) .Returns(proxyDataset.Object); } var projectFacade = new ProjectFacade(project.Object); var projectLink = new Mock<ILinkToProjects>(); { projectLink.Setup(p => p.ActiveProject()) .Returns(projectFacade); } var view = new Mock<IDatasetGraphView>(); { view.SetupSet(v => v.Model = It.IsAny<DatasetGraphModel>()) .Verifiable(); } var parameter = new DatasetGraphParameter(context.Object); var container = new Mock<IDependencyInjectionProxy>(); { container.Setup(c => c.Resolve<IContextAware>()) .Returns(context.Object); container.Setup(c => c.Resolve<ILinkToProjects>()) .Returns(projectLink.Object); container.Setup(c => c.Resolve<ITrackSteppingProgress>()) .Returns(progress.Object); container.Setup(c => c.Resolve<IEventAggregator>()) .Returns(aggregator.Object); container.Setup(c => c.Resolve<Func<string, IDisposable>>()) .Returns(func); } var presenter = new DatasetGraphPresenter(container.Object); ((IPresenter)presenter).Initialize(view.Object, parameter); Assert.AreSame(view.Object, presenter.View); Assert.AreSame(parameter, presenter.Parameter); view.VerifySet(v => v.Model = It.IsAny<DatasetGraphModel>(), Times.Once()); }