コード例 #1
0
        public void Initialize()
        {
            var context = new Mock<IContextAware>();

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

            var parameter = new ProgressParameter(context.Object);
            var container = new Mock<IDependencyInjectionProxy>();
            {
                container.Setup(c => c.Resolve<IContextAware>())
                    .Returns(context.Object);
                container.Setup(c => c.Resolve<ICollectProgressReports>())
                    .Returns(new Mock<ICollectProgressReports>().Object);
            }

            var presenter = new ProgressPresenter(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<ProgressModel>(), Times.Once());
        }
コード例 #2
0
        public void Initialize()
        {
            var context = new Mock <IContextAware>();

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

            var parameter = new ProgressParameter(context.Object);
            var container = new Mock <IDependencyInjectionProxy>();
            {
                container.Setup(c => c.Resolve <IContextAware>())
                .Returns(context.Object);
                container.Setup(c => c.Resolve <ICollectProgressReports>())
                .Returns(new Mock <ICollectProgressReports>().Object);
            }

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