ProjektMWS/Projekt MWS/Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Presenters/TestMainView.cs
2021-06-28 19:31:12 +02:00

69 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using NUnit.Framework;
using Unity.Cloud.Collaborate.Components;
using Unity.Cloud.Collaborate.Presenters;
using Unity.Cloud.Collaborate.Views;
namespace Unity.Cloud.Collaborate.Tests.Presenters
{
internal class TestMainView : IMainView
{
public int? tabIndex;
public bool inProgress;
public (string title, string details, int percentage, int completed, int total, bool isPercentage, bool canCancel)? progress;
[CanBeNull]
public string backNavigation;
public IMainPresenter Presenter { get; set; }
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)>();
public void AddAlert(string id, AlertBox.AlertLevel level, string message, (string text, Action action)? button = null)
{
alerts[id] = (id, level, message, button);
}
public void RemoveAlert(string id)
{
alerts.Remove(id);
}
public void SetTab(int index)
{
tabIndex = index;
}
public void AddOperationProgress()
{
Assert.IsFalse(inProgress);
inProgress = true;
}
public void RemoveOperationProgress()
{
Assert.IsTrue(inProgress);
inProgress = false;
}
public void SetOperationProgress(string title, string details, int percentage, int completed, int total, bool isPercentage, bool canCancel)
{
progress = (title, details, percentage, completed, total, isPercentage, canCancel);
}
public void ClearBackNavigation()
{
backNavigation = null;
}
public void DisplayBackNavigation(string text)
{
backNavigation = text;
}
}
}