Example #1
0
        public void TestReceiveUpdatedChangeListEvent()
        {
            var provider = new TestSourceControlProvider();
            var model    = new ChangesModel(provider);

            var  callCount = 0;
            bool?callValue = null;

            model.BusyStatusUpdated += b =>
            {
                callCount++;
                callValue = b;
            };

            Assert.IsFalse(model.Busy);
            provider.TriggerUpdatedChangeEntries();
            Assert.AreEqual(1, provider.RequestedChangeListCount);
            Assert.IsNotNull(provider.RequestedChangeListCallback);
            Assert.IsTrue(model.Busy);
            Assert.IsTrue(callValue);
            provider.RequestedChangeListCallback.Invoke(new List <IChangeEntry>());
            Assert.IsFalse(model.Busy);
            Assert.IsFalse(callValue);
            Assert.AreEqual(2, callCount);
        }
Example #2
0
        public void TestRequestDiscard()
        {
            var provider = new TestSourceControlProvider();
            var model    = new ChangesModel(provider);

            const string path = "path";

            model.RequestDiscard(path);
            Assert.AreEqual(1, provider.RequestedDiscardCount);
            Assert.AreEqual(path, provider.RequestedDiscardPath);
        }
Example #3
0
        public void TestRequestPublish()
        {
            var provider = new TestSourceControlProvider();
            var model    = new ChangesModel(provider);

            const string message = "message";

            model.RequestPublish(message, new List <IChangeEntry> {
                new ChangeEntry("path1"), new ChangeEntry("path2")
            });
            Assert.AreEqual(1, provider.RequestedPublishCount);
            Assert.AreEqual(message, provider.RequestedPublishMessage);
            Assert.AreEqual(2, provider.RequestedPublishList?.Count);
        }
Example #4
0
        public void TestReceiveUpdatedChangeListEvent()
        {
            var provider = new TestSourceControlProvider();
            var model    = new ChangesModel(provider);

            model.OnStart();

            provider.ChangeList = new List <IChangeEntry> {
                new ChangeEntry("test")
            };

            provider.TriggerUpdatedChangeEntries();
            Assert.AreEqual(2, model.entryData.Count);
        }
Example #5
0
        public void Setup()
        {
            m_Provider = new TestSourceControlProvider();
            m_Model    = new HistoryModel(m_Provider);

            m_BusyStatusUpdatedCount        = 0;
            m_EntryCountUpdatedCount        = 0;
            m_HistoryListReceivedCount      = 0;
            m_HistoryListUpdatedCount       = 0;
            m_SelectedRevisionReceivedCount = 0;

            m_Model.BusyStatusUpdated        += _ => m_BusyStatusUpdatedCount++;
            m_Model.EntryCountUpdated        += _ => m_EntryCountUpdatedCount++;
            m_Model.HistoryListReceived      += _ => m_HistoryListReceivedCount++;
            m_Model.HistoryListUpdated       += () => m_HistoryListUpdatedCount++;
            m_Model.SelectedRevisionReceived += _ => m_SelectedRevisionReceivedCount++;
        }
Example #6
0
 public void TearDown()
 {
     m_Model    = null;
     m_Provider = null;
 }