Esempio n. 1
0
        public void Create()
        {
            var context = new Mock <IContextAware>();
            var proxy   = new Mock <IProxyDataset>();

            var dataset   = new DatasetFacade(proxy.Object);
            var parameter = new DatasetDetailParameter(context.Object, dataset);

            Assert.AreSame(dataset, parameter.Dataset);
        }
        public void Initialize()
        {
            var context    = new Mock <IContextAware>();
            var project    = new Mock <ILinkToProjects>();
            var progress   = new Mock <ITrackSteppingProgress>();
            var aggregator = new Mock <IEventAggregator>();

            var view = new Mock <IDatasetDetailView>();
            {
                view.SetupSet(v => v.Model = It.IsAny <DatasetDetailModel>())
                .Verifiable();
            }

            var proxy     = new Mock <IProxyDataset>();
            var dataset   = new DatasetFacade(proxy.Object);
            var parameter = new DatasetDetailParameter(context.Object, dataset);

            var container = new Mock <IDependencyInjectionProxy>();
            {
                container.Setup(c => c.Resolve <IContextAware>())
                .Returns(context.Object);
                container.Setup(c => c.Resolve <ILinkToProjects>())
                .Returns(project.Object);
                container.Setup(c => c.Resolve <ITrackSteppingProgress>())
                .Returns(progress.Object);
                container.Setup(c => c.Resolve <CloseViewCommand>(It.IsAny <Autofac.Core.Parameter[]>()))
                .Returns(new CloseViewCommand(aggregator.Object, "a", parameter));
            }

            var presenter = new DatasetDetailPresenter(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 <DatasetDetailModel>(), Times.Once());
        }
        public void Initialize()
        {
            var context = new Mock<IContextAware>();
            var project = new Mock<ILinkToProjects>();
            var progress = new Mock<ITrackSteppingProgress>();
            var aggregator = new Mock<IEventAggregator>();

            var view = new Mock<IDatasetDetailView>();
            {
                view.SetupSet(v => v.Model = It.IsAny<DatasetDetailModel>())
                    .Verifiable();
            }

            var proxy = new Mock<IProxyDataset>();
            var dataset = new DatasetFacade(proxy.Object);
            var parameter = new DatasetDetailParameter(context.Object, dataset);

            var container = new Mock<IDependencyInjectionProxy>();
            {
                container.Setup(c => c.Resolve<IContextAware>())
                    .Returns(context.Object);
                container.Setup(c => c.Resolve<ILinkToProjects>())
                    .Returns(project.Object);
                container.Setup(c => c.Resolve<ITrackSteppingProgress>())
                    .Returns(progress.Object);
                container.Setup(c => c.Resolve<CloseViewCommand>(It.IsAny<Autofac.Core.Parameter[]>()))
                    .Returns(new CloseViewCommand(aggregator.Object, "a", parameter));
            }

            var presenter = new DatasetDetailPresenter(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<DatasetDetailModel>(), Times.Once());
        }