TestMainModel.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. using System;
  2. using NUnit.Framework;
  3. using Unity.Cloud.Collaborate.Models;
  4. using Unity.Cloud.Collaborate.Models.Structures;
  5. using Unity.Cloud.Collaborate.UserInterface;
  6. namespace Unity.Cloud.Collaborate.Tests.Models
  7. {
  8. internal class TestMainModel : IMainModel
  9. {
  10. public int clearErrorCount;
  11. public int requestSyncCount;
  12. public int requestCancelJobCount;
  13. public IHistoryModel historyModel = new TestHistoryModel();
  14. public IChangesModel changesModel = new TestChangesModel();
  15. public (string id, string text, Action backAction)? backNavigation;
  16. public event Action<bool> ConflictStatusChange = delegate { };
  17. public void TriggerConflictStatusChange(bool conflict)
  18. {
  19. ConflictStatusChange(conflict);
  20. }
  21. public event Action<bool> OperationStatusChange = delegate { };
  22. public void TriggerOperationStatusChange(bool inProgress)
  23. {
  24. OperationStatusChange(inProgress);
  25. }
  26. public event Action<IProgressInfo> OperationProgressChange = delegate { };
  27. public void TriggerOperationProgressChange(IProgressInfo progressInfo)
  28. {
  29. OperationProgressChange(progressInfo);
  30. }
  31. public event Action<IErrorInfo> ErrorOccurred = delegate { };
  32. public void TriggerErrorOccurred(IErrorInfo errorInfo)
  33. {
  34. ErrorOccurred(errorInfo);
  35. }
  36. public event Action ErrorCleared = delegate { };
  37. public void TriggerErrorCleared()
  38. {
  39. ErrorCleared();
  40. }
  41. public event Action<bool> RemoteRevisionsAvailabilityChange = delegate { };
  42. public void TriggerRemoteRevisionsAvailabilityChange(bool available)
  43. {
  44. RemoteRevisionsAvailabilityChange(available);
  45. }
  46. public event Action<string> BackButtonStateUpdated = delegate { };
  47. public void TriggerBackButtonStateUpdated(string backText)
  48. {
  49. BackButtonStateUpdated(backText);
  50. }
  51. public event Action StateChanged = delegate { };
  52. public void TriggerStateChanged()
  53. {
  54. StateChanged();
  55. }
  56. public bool RemoteRevisionsAvailable { get; set; }
  57. public bool Conflicted { get; set; }
  58. public IProgressInfo ProgressInfo { get; set; }
  59. public IErrorInfo ErrorInfo { get; set; }
  60. public int CurrentTabIndex { get; set; }
  61. public IHistoryModel ConstructHistoryModel()
  62. {
  63. return historyModel;
  64. }
  65. public IChangesModel ConstructChangesModel()
  66. {
  67. return changesModel;
  68. }
  69. public void ClearError()
  70. {
  71. clearErrorCount++;
  72. }
  73. public void RequestSync()
  74. {
  75. requestSyncCount++;
  76. }
  77. public void RequestCancelJob()
  78. {
  79. requestCancelJobCount++;
  80. }
  81. public (string id, string text, Action backAction)? GetBackNavigation()
  82. {
  83. return backNavigation;
  84. }
  85. public void RegisterBackNavigation(string id, string text, Action backAction)
  86. {
  87. Assert.IsNull(backNavigation);
  88. backNavigation = (id, text, backAction);
  89. }
  90. public bool UnregisterBackNavigation(string id)
  91. {
  92. if (backNavigation == null || backNavigation.Value.id != id)
  93. return false;
  94. backNavigation = null;
  95. return true;
  96. }
  97. public void OnStart()
  98. {
  99. throw new NotImplementedException();
  100. }
  101. public void OnStop()
  102. {
  103. throw new NotImplementedException();
  104. }
  105. public void RestoreState(IWindowCache cache)
  106. {
  107. throw new NotImplementedException();
  108. }
  109. public void SaveState(IWindowCache cache)
  110. {
  111. throw new NotImplementedException();
  112. }
  113. }
  114. }