TestMainView.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using JetBrains.Annotations;
  4. using NUnit.Framework;
  5. using Unity.Cloud.Collaborate.Components;
  6. using Unity.Cloud.Collaborate.Presenters;
  7. using Unity.Cloud.Collaborate.Views;
  8. namespace Unity.Cloud.Collaborate.Tests.Presenters
  9. {
  10. internal class TestMainView : IMainView
  11. {
  12. public int? tabIndex;
  13. public bool inProgress;
  14. public (string title, string details, int percentage, int completed, int total, bool isPercentage, bool canCancel)? progress;
  15. [CanBeNull]
  16. public string backNavigation;
  17. public IMainPresenter Presenter { get; set; }
  18. public Dictionary<string, (string id, AlertBox.AlertLevel level, string message, (string text, Action action)? button)> alerts = new Dictionary<string, (string id, AlertBox.AlertLevel level, string message, (string text, Action action)? button)>();
  19. public void AddAlert(string id, AlertBox.AlertLevel level, string message, (string text, Action action)? button = null)
  20. {
  21. alerts[id] = (id, level, message, button);
  22. }
  23. public void RemoveAlert(string id)
  24. {
  25. alerts.Remove(id);
  26. }
  27. public void SetTab(int index)
  28. {
  29. tabIndex = index;
  30. }
  31. public void AddOperationProgress()
  32. {
  33. Assert.IsFalse(inProgress);
  34. inProgress = true;
  35. }
  36. public void RemoveOperationProgress()
  37. {
  38. Assert.IsTrue(inProgress);
  39. inProgress = false;
  40. }
  41. public void SetOperationProgress(string title, string details, int percentage, int completed, int total, bool isPercentage, bool canCancel)
  42. {
  43. progress = (title, details, percentage, completed, total, isPercentage, canCancel);
  44. }
  45. public void ClearBackNavigation()
  46. {
  47. backNavigation = null;
  48. }
  49. public void DisplayBackNavigation(string text)
  50. {
  51. backNavigation = text;
  52. }
  53. }
  54. }