Пример #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();
        }
Пример #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();
        }
Пример #3
0
 void ILandController.RemoveListener(ILandsListener listener)
 {
     OnLandsSet -= listener.OnSetLands;
 }
Пример #4
0
 void ILandController.AddListener(ILandsListener listener)
 {
     OnLandsSet += listener.OnSetLands;
     listener.OnSetLands(userLands);
 }
Пример #5
0
 public void RemoveListener(ILandsListener listener)
 {
     OnLandsSet -= listener.OnSetLands;
 }
Пример #6
0
 public void AddListener(ILandsListener listener)
 {
     OnLandsSet += listener.OnSetLands;
     listener.OnSetLands(userLands);
 }