Ejemplo n.º 1
0
        public void UpdateLandCorrectly()
        {
            const string startingName = "Temptation";
            const string updatedName  = "New Temptation";

            SectionLandController controller      = new SectionLandController(view);
            ILandsListener        landsListener   = controller;
            LandElementView       landElementView = view.GetLandElementeBaseView();

            landsListener.OnSetLands(new [] { new LandData()
                                              {
                                                  id   = "1",
                                                  name = startingName
                                              } });
            Assert.AreEqual(1, GetVisibleChildrenAmount(view.GetLandElementsContainer()));
            Assert.AreEqual(startingName, landElementView.landName.text);

            landsListener.OnSetLands(new [] { new LandData()
                                              {
                                                  id   = "1",
                                                  name = updatedName
                                              } });
            Assert.AreEqual(1, GetVisibleChildrenAmount(view.GetLandElementsContainer()));
            Assert.AreEqual(updatedName, landElementView.landName.text);


            controller.Dispose();
        }
Ejemplo n.º 2
0
        public void SetLandsCorrectly()
        {
            SectionLandController controller    = new SectionLandController(view);
            ILandsListener        landsListener = controller;

            landsListener.OnSetLands(new [] { new LandData()
                                              {
                                                  id = "1"
                                              }, new LandData()
                                              {
                                                  id = "2"
                                              } });
            Assert.AreEqual(2, GetVisibleChildrenAmount(view.GetLandElementsContainer()));
            Assert.IsTrue(view.contentContainer.activeSelf);

            landsListener.OnSetLands(new [] { new LandData()
                                              {
                                                  id = "1"
                                              } });
            Assert.AreEqual(1, GetVisibleChildrenAmount(view.GetLandElementsContainer()));
            Assert.IsTrue(view.contentContainer.activeSelf);

            landsListener.OnSetLands(new LandData[] {});
            Assert.AreEqual(0, GetVisibleChildrenAmount(view.GetLandElementsContainer()));
            Assert.IsFalse(view.contentContainer.activeSelf);
            Assert.IsTrue(view.emptyContainer.activeSelf);

            controller.Dispose();
        }
Ejemplo n.º 3
0
 void ILandController.AddListener(ILandsListener listener)
 {
     OnLandsSet += listener.OnSetLands;
     listener.OnSetLands(userLands);
 }
Ejemplo n.º 4
0
 public void AddListener(ILandsListener listener)
 {
     OnLandsSet += listener.OnSetLands;
     listener.OnSetLands(userLands);
 }