示例#1
0
        public void ShouldCohexistSeveralInstancesWithDifferentViewsInDifferentExecutionContexts()
        {
            Nails.Reset(false);

            Nails.Configure()
            .IoC.Container <NailsFramework.IoC.Spring>()
            .Lemming <TestSingletonPresenter>()
            .Lemming <SwitcheableExcecutionContext>()
            .UserInterface.Platform <NullMvp>()
            .Initialize();

            var context = Nails.ObjectFactory.GetObject <SwitcheableExcecutionContext>();

            var view1 = new TestSingletonView();
            var view2 = new TestSingletonView();

            context.SwitchToA();
            var presenter1 = PresenterProvider.GetFor(view1);

            context.SwitchToB();
            var presenter2 = PresenterProvider.GetFor(view2);

            Assert.AreSame(presenter1, presenter2);
            context.SwitchToA();
            Assert.AreEqual(presenter1.GetView(), view1);
            context.SwitchToB();
            Assert.AreEqual(presenter2.GetView(), view2);
        }
示例#2
0
        private void Awake()
        {
            _presenter = PresenterProvider.GetDialoguePresenter(this);

            _image.enabled = false;
            _text.enabled  = false;
        }
示例#3
0
        public void ShouldNotCohexistSeveralInstancesWithDifferentViewsInTheSameExecutionContext()
        {
            Nails.Configure().IoC.Container <NailsFramework.IoC.Spring>()
            .Lemming <TestSingletonPresenter>()
            .UserInterface.Platform <NullMvp>()
            .Initialize();

            var view1 = new TestSingletonView();
            var view2 = new TestSingletonView();

            var presenter1 = PresenterProvider.GetFor(view1);

            var presenter2 = PresenterProvider.GetFor(view2);

            Assert.AreSame(presenter1, presenter2);
            Assert.AreEqual(presenter1.GetView(), view2); //the last one
        }
        public void ShouldCohexistSeveralInstancesWithDifferentViews()
        {
            Nails.Configure()
            .IoC.Container <NailsFramework.IoC.Spring>()
            .Lemming <TestPresenter>()
            .UserInterface.Platform <NullMvp>()
            .Initialize();

            var view1 = new TestView();
            var view2 = new TestView();

            var presenter1 = PresenterProvider.GetFor(view1);
            var presenter2 = PresenterProvider.GetFor(view2);

            Assert.AreNotEqual(presenter1, presenter2);
            Assert.AreEqual(presenter1.GetView(), view1);
            Assert.AreEqual(presenter2.GetView(), view2);
        }
        public void ShouldReturnPresenterForTheDefinedView()
        {
            var mocks         = new MockRepository();
            var objectFactory = mocks.DynamicMock <IObjectFactory>();
            var presenter     = new TestPresenter();

            objectFactory.Expect(x => x.GetObject(typeof(ITestPresenter))).Return(presenter);

            mocks.ReplayAll();
            IView view = new TestView();

            PresenterProvider.ObjectFactory = objectFactory;
            var providedPresenter = PresenterProvider.GetFor(view);

            mocks.VerifyAll();
            Assert.AreEqual(presenter, providedPresenter);
            Assert.AreEqual(view, presenter.GetView());
        }
示例#6
0
 private void Awake()
 {
     _presenter = PresenterProvider.GetTurretPanelPresenter(this);
 }
示例#7
0
 private void Awake()
 {
     _presenter = PresenterProvider.GetHealthBarPresenter(this);
 }