Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,594 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using NUnit.Framework;
|
||||
using Unity.Cloud.Collaborate.Models;
|
||||
using Unity.Cloud.Collaborate.Models.Structures;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Tests.Models
|
||||
{
|
||||
public class ChangesModelTests
|
||||
{
|
||||
class TestableChangesModel : ChangesModel
|
||||
{
|
||||
public TestSourceControlProvider Provider => (TestSourceControlProvider)m_Provider;
|
||||
|
||||
public TestableChangesModel() : base (new TestSourceControlProvider())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetToggled([CanBeNull] Dictionary<string, bool> toggled = null)
|
||||
{
|
||||
if (toggled != null)
|
||||
{
|
||||
toggledEntries = toggled;
|
||||
}
|
||||
}
|
||||
|
||||
internal override void UpdateChangeList(IReadOnlyList<IChangeEntry> list)
|
||||
{
|
||||
base.UpdateChangeList(list);
|
||||
ValidateData();
|
||||
}
|
||||
|
||||
public override bool UpdateEntryToggle(string path, bool value)
|
||||
{
|
||||
var refresh = base.UpdateEntryToggle(path, value);
|
||||
ValidateData();
|
||||
return refresh;
|
||||
}
|
||||
|
||||
void ValidateData()
|
||||
{
|
||||
var toggledCount = 0;
|
||||
foreach (var x in entryData.Select(entry => entry.Value))
|
||||
{
|
||||
Assert.IsTrue(toggledEntries.TryGetValue(x.Entry.Path, out var toggled) && x.Toggled == toggled);
|
||||
if (!x.All && toggled) toggledCount++;
|
||||
}
|
||||
Assert.AreEqual(toggledCount, ToggledCount);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_NullSourceControlEntries_EmptyResultLists()
|
||||
{
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
model.UpdateChangeList(new List<IChangeEntry>());
|
||||
|
||||
var fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(1, fullList.Count);
|
||||
Assert.IsTrue(fullList[0].All);
|
||||
|
||||
Assert.AreEqual(0, model.GetToggledEntries().Count);
|
||||
Assert.AreEqual(0, model.GetUntoggledEntries().Count);
|
||||
|
||||
Assert.AreEqual(0, model.ToggledCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_EmptySourceControlEntries_EmptyResultLists()
|
||||
{
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
model.UpdateChangeList(new List<IChangeEntry>());
|
||||
|
||||
var fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(1, fullList.Count);
|
||||
Assert.IsTrue(fullList[0].All);
|
||||
|
||||
Assert.AreEqual(0, model.GetToggledEntries().Count);
|
||||
Assert.AreEqual(0, model.GetUntoggledEntries().Count);
|
||||
|
||||
Assert.AreEqual(0, model.ToggledCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_SingleSourceControlEntries_SingleUntoggledResult()
|
||||
{
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
var changes = BuildChangesList(1);
|
||||
model.UpdateChangeList(changes);
|
||||
|
||||
var fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(2, fullList.Count);
|
||||
Assert.IsTrue(fullList[0].All);
|
||||
Assert.IsFalse(fullList[0].Toggled);
|
||||
Assert.IsFalse(fullList[1].All);
|
||||
Assert.IsFalse(fullList[1].Toggled);
|
||||
|
||||
var toggledList = model.GetToggledEntries();
|
||||
Assert.AreEqual(0, toggledList.Count);
|
||||
|
||||
var untoggledList = model.GetUntoggledEntries();
|
||||
Assert.AreEqual(1, untoggledList.Count);
|
||||
Assert.IsFalse(untoggledList[0].All);
|
||||
Assert.IsFalse(untoggledList[0].Toggled);
|
||||
|
||||
Assert.AreEqual(0, model.ToggledCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_MultipleSourceControlEntries_ToggleSingle()
|
||||
{
|
||||
const int entryCount = 5;
|
||||
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
var changes = BuildChangesList(entryCount);
|
||||
model.UpdateChangeList(changes);
|
||||
|
||||
var fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(entryCount, model.TotalCount);
|
||||
Assert.AreEqual(entryCount + 1, fullList.Count);
|
||||
Assert.IsTrue(fullList[0].All);
|
||||
|
||||
var toggledEntry = fullList[entryCount / 2 + 1];
|
||||
model.UpdateEntryToggle(toggledEntry.Entry.Path, true);
|
||||
Assert.IsTrue(toggledEntry.Toggled);
|
||||
|
||||
fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(entryCount + 1, fullList.Count);
|
||||
foreach (var entry in fullList)
|
||||
{
|
||||
if (entry == fullList[0])
|
||||
{
|
||||
Assert.IsTrue(entry.All);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
}
|
||||
|
||||
if (entry == toggledEntry)
|
||||
{
|
||||
Assert.IsTrue(entry.Toggled);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(entry.Toggled);
|
||||
}
|
||||
}
|
||||
|
||||
var toggledList = model.GetToggledEntries();
|
||||
Assert.AreEqual(1, toggledList.Count);
|
||||
Assert.AreEqual(toggledEntry, toggledList[0]);
|
||||
|
||||
var untoggledList = model.GetUntoggledEntries();
|
||||
Assert.AreEqual(entryCount -1, untoggledList.Count);
|
||||
foreach (var entry in untoggledList)
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
Assert.AreNotEqual(toggledEntry, entry);
|
||||
}
|
||||
|
||||
Assert.AreEqual(1, model.ToggledCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_MultipleSourceControlEntries_ToggleAll()
|
||||
{
|
||||
const int entryCount = 5;
|
||||
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
var changes = BuildChangesList(entryCount);
|
||||
model.UpdateChangeList(changes);
|
||||
|
||||
var fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(entryCount + 1, fullList.Count);
|
||||
Assert.IsTrue(fullList[0].All);
|
||||
|
||||
model.UpdateEntryToggle(fullList[0].Entry.Path, true);
|
||||
|
||||
fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(entryCount + 1, fullList.Count);
|
||||
foreach (var entry in fullList)
|
||||
{
|
||||
if (entry == fullList[0])
|
||||
{
|
||||
Assert.IsTrue(entry.All);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
}
|
||||
Assert.IsTrue(entry.Toggled);
|
||||
}
|
||||
|
||||
var toggledList = model.GetToggledEntries();
|
||||
Assert.AreEqual(entryCount, toggledList.Count);
|
||||
foreach (var entry in toggledList)
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
}
|
||||
|
||||
var untoggledList = model.GetUntoggledEntries();
|
||||
Assert.AreEqual(0, untoggledList.Count);
|
||||
|
||||
Assert.AreEqual(entryCount, model.ToggledCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_MultipleSourceControlEntries_ToggleAllIndividually()
|
||||
{
|
||||
const int entryCount = 5;
|
||||
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
var changes = BuildChangesList(entryCount);
|
||||
model.UpdateChangeList(changes);
|
||||
|
||||
var fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(entryCount + 1, fullList.Count);
|
||||
Assert.IsTrue(fullList[0].All);
|
||||
|
||||
fullList = model.GetAllEntries();
|
||||
foreach (var entry in fullList.Where(entry => !entry.All))
|
||||
{
|
||||
model.UpdateEntryToggle(entry.Entry.Path, true);
|
||||
}
|
||||
|
||||
Assert.AreEqual(entryCount + 1, fullList.Count);
|
||||
foreach (var entry in fullList)
|
||||
{
|
||||
if (entry == fullList[0])
|
||||
{
|
||||
Assert.IsTrue(entry.All);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
}
|
||||
Assert.IsTrue(entry.Toggled);
|
||||
}
|
||||
|
||||
var toggledList = model.GetToggledEntries();
|
||||
Assert.AreEqual(entryCount, toggledList.Count);
|
||||
foreach (var entry in toggledList)
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
}
|
||||
|
||||
var untoggledList = model.GetUntoggledEntries();
|
||||
Assert.AreEqual(0, untoggledList.Count);
|
||||
|
||||
Assert.AreEqual(entryCount, model.ToggledCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_MultipleSourceControlEntries_UntoggleSingleFromAll()
|
||||
{
|
||||
const int entryCount = 5;
|
||||
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
var changes = BuildChangesList(entryCount);
|
||||
model.UpdateChangeList(changes);
|
||||
|
||||
var fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(entryCount + 1, fullList.Count);
|
||||
Assert.IsTrue(fullList[0].All);
|
||||
|
||||
model.UpdateEntryToggle(fullList[0].Entry.Path, true);
|
||||
var untoggledEntry = fullList[entryCount / 2 + 1];
|
||||
model.UpdateEntryToggle(untoggledEntry.Entry.Path, false);
|
||||
Assert.IsFalse(untoggledEntry.Toggled);
|
||||
|
||||
fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(entryCount + 1, fullList.Count);
|
||||
foreach (var entry in fullList)
|
||||
{
|
||||
if (entry == fullList[0])
|
||||
{
|
||||
Assert.IsTrue(entry.All);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
}
|
||||
|
||||
if (entry == untoggledEntry || entry.All)
|
||||
{
|
||||
Assert.IsFalse(entry.Toggled);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsTrue(entry.Toggled);
|
||||
}
|
||||
}
|
||||
|
||||
var toggledList = model.GetToggledEntries();
|
||||
Assert.AreEqual(entryCount - 1, toggledList.Count);
|
||||
foreach (var entry in toggledList)
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
Assert.AreNotEqual(untoggledEntry, entry);
|
||||
}
|
||||
|
||||
var untoggledList = model.GetUntoggledEntries();
|
||||
Assert.AreEqual(1, untoggledList.Count);
|
||||
Assert.AreEqual(untoggledEntry, untoggledList[0]);
|
||||
|
||||
Assert.AreEqual(entryCount - 1, model.ToggledCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_MultipleSourceControlEntries_SomeConflicted()
|
||||
{
|
||||
const string conflictedPrefix = "conflicted-path";
|
||||
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
var changes = new List<IChangeEntry>();
|
||||
AddEntry(changes, "path1", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "path2", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "path3", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, $"{conflictedPrefix}4", ChangeEntryStatus.Modified, false, true);
|
||||
AddEntry(changes, $"{conflictedPrefix}5", ChangeEntryStatus.Modified, false, true);
|
||||
model.UpdateChangeList(changes);
|
||||
|
||||
var conflictedList = model.GetConflictedEntries();
|
||||
model.Provider.ConflictedState = true;
|
||||
Assert.IsTrue(model.Conflicted);
|
||||
Assert.AreEqual(2, model.ConflictedCount);
|
||||
Assert.AreEqual(2, conflictedList.Count);
|
||||
Assert.IsFalse(conflictedList[0].All);
|
||||
Assert.IsFalse(conflictedList[1].All);
|
||||
Assert.IsTrue(conflictedList[0].Conflicted);
|
||||
Assert.IsTrue(conflictedList[1].Conflicted);
|
||||
|
||||
Assert.IsTrue(conflictedList[0].Entry.Path.StartsWith(conflictedPrefix));
|
||||
Assert.IsTrue(conflictedList[1].Entry.Path.StartsWith(conflictedPrefix));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_InitializeFromDictionary_TransfersToggledFlag()
|
||||
{
|
||||
const int entryCount = 5;
|
||||
const int toggledCount = 2;
|
||||
const int toggledIndex1 = 0;
|
||||
const int toggledIndex2 = entryCount / 2 + 1;
|
||||
const int untoggledIndex = entryCount - 1;
|
||||
|
||||
var changes = BuildChangesList(entryCount);
|
||||
var dictionary = new Dictionary<string, bool>();
|
||||
changes.ForEach( (x) => dictionary[x.Path] = false );
|
||||
dictionary[changes[toggledIndex1].Path] = true;
|
||||
dictionary[changes[toggledIndex2].Path] = true;
|
||||
dictionary[changes[untoggledIndex].Path] = false;
|
||||
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
model.SetToggled(dictionary);
|
||||
model.UpdateChangeList(changes);
|
||||
|
||||
var fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(entryCount + 1, fullList.Count);
|
||||
foreach (var entry in fullList)
|
||||
{
|
||||
if (entry == fullList[0])
|
||||
{
|
||||
Assert.IsTrue(entry.All);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
}
|
||||
|
||||
if (entry.Entry.Path == changes[toggledIndex1].Path || entry.Entry.Path == changes[toggledIndex2].Path)
|
||||
{
|
||||
Assert.IsTrue(entry.Toggled);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(entry.Toggled);
|
||||
}
|
||||
}
|
||||
|
||||
var toggledList = model.GetToggledEntries();
|
||||
Assert.AreEqual(toggledCount, toggledList.Count);
|
||||
foreach (var entry in toggledList)
|
||||
{
|
||||
Assert.IsTrue(entry.Entry.Path == changes[toggledIndex1].Path || entry.Entry.Path == changes[toggledIndex2].Path);
|
||||
Assert.IsFalse(entry.All);
|
||||
Assert.IsTrue(entry.Toggled);
|
||||
}
|
||||
|
||||
var untoggledList = model.GetUntoggledEntries();
|
||||
Assert.AreEqual(entryCount - toggledCount, untoggledList.Count);
|
||||
foreach (var entry in untoggledList)
|
||||
{
|
||||
Assert.IsTrue(entry.Entry.Path != changes[toggledIndex1].Path && entry.Entry.Path != changes[toggledIndex2].Path);
|
||||
Assert.IsFalse(entry.All);
|
||||
Assert.IsFalse(entry.Toggled);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChangesModel_SearchFilters_CaseInsensitive()
|
||||
{
|
||||
var changes = new List<IChangeEntry>();
|
||||
AddEntry(changes, "alpha1", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "alpha2", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "bravo", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "charlie", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "Delta3", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "delta4", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "delta5", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "echo", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "Foxtrot6", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "Foxtrot7", ChangeEntryStatus.Modified, false);
|
||||
AddEntry(changes, "golf", ChangeEntryStatus.Modified, false);
|
||||
|
||||
var dictionary = new Dictionary<string, bool>
|
||||
{
|
||||
["delta5"] = true, ["Foxtrot6"] = true, ["Foxtrot7"] = true, ["golf"] = true
|
||||
};
|
||||
|
||||
var model = new TestableChangesModel();
|
||||
model.OnStart();
|
||||
model.SetToggled(dictionary);
|
||||
model.UpdateChangeList(changes);
|
||||
|
||||
var fullList = model.GetAllEntries();
|
||||
Assert.AreEqual(changes.Count, model.TotalCount);
|
||||
Assert.AreEqual(changes.Count + 1, fullList.Count);
|
||||
Assert.IsTrue(fullList[0].All);
|
||||
|
||||
var searchFullList = model.GetAllEntries("alpha");
|
||||
Assert.AreEqual(2, searchFullList.Count);
|
||||
foreach (var entry in searchFullList)
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
Assert.IsFalse(entry.Toggled);
|
||||
}
|
||||
|
||||
var toggledList = model.GetToggledEntries();
|
||||
Assert.AreEqual(dictionary.Count, toggledList.Count);
|
||||
foreach (var entry in toggledList)
|
||||
{
|
||||
Assert.IsFalse(entry.All);
|
||||
}
|
||||
|
||||
var searchToggledList = model.GetToggledEntries("fox");
|
||||
Assert.AreEqual(2, searchToggledList.Count);
|
||||
foreach (var entry in searchToggledList)
|
||||
{
|
||||
Assert.IsTrue(entry.Entry.Path.ToLower().Contains("fox"));
|
||||
Assert.IsFalse(entry.All);
|
||||
Assert.IsTrue(entry.Toggled);
|
||||
}
|
||||
|
||||
var untoggledList = model.GetUntoggledEntries();
|
||||
Assert.AreEqual(changes.Count - dictionary.Count, untoggledList.Count);
|
||||
|
||||
var searchUntoggledList = model.GetUntoggledEntries("Del");
|
||||
Assert.AreEqual(2, searchUntoggledList.Count);
|
||||
foreach (var entry in searchUntoggledList)
|
||||
{
|
||||
Assert.IsTrue(entry.Entry.Path.ToLower().Contains("del"));
|
||||
Assert.AreNotEqual("delta5", entry.Entry.Path);
|
||||
Assert.IsFalse(entry.All);
|
||||
Assert.IsFalse(entry.Toggled);
|
||||
}
|
||||
|
||||
Assert.AreEqual(dictionary.Count, model.ToggledCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestInitialData()
|
||||
{
|
||||
var provider = new TestSourceControlProvider();
|
||||
var model = new ChangesModel(provider);
|
||||
model.OnStart();
|
||||
|
||||
var callCount = 0;
|
||||
bool? callValue = null;
|
||||
model.BusyStatusUpdated += b =>
|
||||
{
|
||||
callCount++;
|
||||
callValue = b;
|
||||
};
|
||||
|
||||
Assert.IsFalse(model.Busy);
|
||||
model.RequestInitialData();
|
||||
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);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReceiveUpdatedChangeListEvent()
|
||||
{
|
||||
var provider = new TestSourceControlProvider();
|
||||
var model = new ChangesModel(provider);
|
||||
model.OnStart();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestDiff()
|
||||
{
|
||||
var provider = new TestSourceControlProvider();
|
||||
var model = new ChangesModel(provider);
|
||||
model.OnStart();
|
||||
|
||||
const string path = "path";
|
||||
model.RequestDiffChanges(path);
|
||||
Assert.AreEqual(1, provider.RequestedDiffChangesCount);
|
||||
Assert.AreEqual(path, provider.RequestedDiffChangesPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestDiscard()
|
||||
{
|
||||
var provider = new TestSourceControlProvider();
|
||||
var model = new ChangesModel(provider);
|
||||
model.OnStart();
|
||||
|
||||
const string path = "path";
|
||||
var entry = new ChangeEntry(path);
|
||||
model.RequestDiscard(entry);
|
||||
Assert.AreEqual(1, provider.RequestedDiscardCount);
|
||||
Assert.AreEqual(path, provider.RequestedDiscardEntry?.Path);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestPublish()
|
||||
{
|
||||
var provider = new TestSourceControlProvider();
|
||||
var model = new ChangesModel(provider);
|
||||
model.OnStart();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void AddEntry(ICollection<IChangeEntry> list, string pathTag, ChangeEntryStatus status, bool staged, bool unmerged = false)
|
||||
{
|
||||
list.Add(new ChangeEntry(pathTag, $"Original{pathTag}", status, staged, unmerged));
|
||||
}
|
||||
|
||||
static List<IChangeEntry> BuildChangesList(int count)
|
||||
{
|
||||
var changes = new List<IChangeEntry>();
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
AddEntry(changes, $"Path{i}", ChangeEntryStatus.Modified, false);
|
||||
}
|
||||
|
||||
return changes;
|
||||
}
|
||||
}
|
||||
}
|
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/ChangesModelTests.cs.meta
generated
Normal file
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/ChangesModelTests.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1ac075bf7cbc97f4fbba27c78feb9c18
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,130 @@
|
|||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using Unity.Cloud.Collaborate.Models;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Tests.Models
|
||||
{
|
||||
public class HistoryModelTests
|
||||
{
|
||||
TestSourceControlProvider m_Provider;
|
||||
HistoryModel m_Model;
|
||||
|
||||
int m_BusyStatusUpdatedCount;
|
||||
int m_EntryCountUpdatedCount;
|
||||
int m_HistoryListReceivedCount;
|
||||
int m_HistoryListUpdatedCount;
|
||||
int m_SelectedRevisionReceivedCount;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
m_Provider = new TestSourceControlProvider();
|
||||
m_Model = new HistoryModel(m_Provider);
|
||||
m_Model.OnStart();
|
||||
|
||||
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++;
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
m_Model = null;
|
||||
m_Provider = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHistoryListUpdated()
|
||||
{
|
||||
m_Provider.TriggerUpdatedHistoryEntries();
|
||||
Assert.AreEqual(1, m_HistoryListUpdatedCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIsBusyAndEntryCount()
|
||||
{
|
||||
m_Model.RequestEntryNumber();
|
||||
Assert.AreEqual(1, m_Provider.RequestedHistoryCountCount);
|
||||
Assert.AreEqual(false, m_Model.Busy);
|
||||
Assert.AreEqual(2, m_BusyStatusUpdatedCount);
|
||||
Assert.AreEqual(1, m_EntryCountUpdatedCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestingPageOfRevisions()
|
||||
{
|
||||
m_Model.PageNumber = 2;
|
||||
m_Model.RequestPageOfRevisions(10);
|
||||
Assert.AreEqual(1, m_Provider.RequestedHistoryListCount);
|
||||
Assert.AreEqual(20, m_Provider.RequestedHistoryListOffset);
|
||||
Assert.AreEqual(10, m_Provider.RequestedHistoryListSize);
|
||||
Assert.AreEqual(2, m_BusyStatusUpdatedCount);
|
||||
Assert.AreEqual(1, m_HistoryListReceivedCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestingSingleRevision()
|
||||
{
|
||||
const string revisionId = "123";
|
||||
|
||||
Assert.AreEqual(false, m_Model.IsRevisionSelected);
|
||||
Assert.AreEqual(string.Empty, m_Model.SelectedRevisionId);
|
||||
m_Model.RequestSingleRevision(revisionId);
|
||||
Assert.AreEqual(true, m_Model.IsRevisionSelected);
|
||||
Assert.AreEqual(1, m_Provider.RequestedHistoryRevisionCount);
|
||||
Assert.AreEqual(revisionId, m_Provider.RequestedHistoryRevisionId);
|
||||
Assert.AreEqual(2, m_BusyStatusUpdatedCount);
|
||||
Assert.AreEqual(1, m_SelectedRevisionReceivedCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestUpdateTo()
|
||||
{
|
||||
const string revisionId = "123";
|
||||
|
||||
m_Model.RequestUpdateTo(revisionId);
|
||||
Assert.AreEqual(1, m_Provider.RequestedUpdateToCount);
|
||||
Assert.AreEqual(revisionId, m_Provider.RequestedUpdateToRevisionId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestRestoreTo()
|
||||
{
|
||||
const string revisionId = "123";
|
||||
|
||||
m_Model.RequestRestoreTo(revisionId);
|
||||
Assert.AreEqual(1, m_Provider.RequestedRestoreToCount);
|
||||
Assert.AreEqual(revisionId, m_Provider.RequestedRestoreToRevisionId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestGoBackTo()
|
||||
{
|
||||
const string revisionId = "123";
|
||||
|
||||
m_Model.RequestGoBackTo(revisionId);
|
||||
Assert.AreEqual(1, m_Provider.RequestedGoBackToCount);
|
||||
Assert.AreEqual(revisionId, m_Provider.RequestedGoBackToRevisionId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevert()
|
||||
{
|
||||
const string revisionId = "123";
|
||||
|
||||
m_Model.RequestRevert(revisionId, new List<string> { "a", "b", "c" });
|
||||
Assert.AreEqual(1, m_Provider.RequestedRevertCount);
|
||||
Assert.AreEqual(revisionId, m_Provider.RequestedRevertRevisionId);
|
||||
Assert.AreEqual(3, m_Provider.RequestedRevertFileCount);
|
||||
}
|
||||
}
|
||||
}
|
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/HistoryModelTests.cs.meta
generated
Normal file
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/HistoryModelTests.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2079ae55f950aa4439a7ca7af8a9c136
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
3
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/Providers.meta
generated
Normal file
3
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/Providers.meta
generated
Normal file
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2fd9db3c67f54e59bb315a02250dbaf3
|
||||
timeCreated: 1576179242
|
|
@ -0,0 +1,254 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using NUnit.Framework;
|
||||
using Unity.Cloud.Collaborate.Models.Api;
|
||||
using Unity.Cloud.Collaborate.Models.Enums;
|
||||
using Unity.Cloud.Collaborate.Models.Structures;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Models.Providers
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal class MockSourceControlProvider : ISourceControlProvider
|
||||
{
|
||||
public event Action UpdatedChangeList = delegate { };
|
||||
public event Action<IReadOnlyList<string>> UpdatedSelectedChangeList = delegate { };
|
||||
public event Action UpdatedHistoryEntries = delegate { };
|
||||
public event Action<bool> UpdatedConflictState = delegate { };
|
||||
public event Action<bool> UpdatedRemoteRevisionsAvailability = delegate { };
|
||||
public event Action<ProjectStatus> UpdatedProjectStatus = delegate { };
|
||||
|
||||
public event Action<bool> UpdatedOperationStatus = delegate { };
|
||||
public event Action<IProgressInfo> UpdatedOperationProgress = delegate { };
|
||||
|
||||
public event Action<IErrorInfo> ErrorOccurred = delegate { };
|
||||
public event Action ErrorCleared = delegate { };
|
||||
|
||||
List<IChangeEntry> m_Changes;
|
||||
readonly List<IHistoryEntry> m_History;
|
||||
|
||||
public MockSourceControlProvider()
|
||||
{
|
||||
m_Changes = new List<IChangeEntry>
|
||||
{
|
||||
new ChangeEntry("SomePath", "SomeOriginalPath", ChangeEntryStatus.Modified),
|
||||
new ChangeEntry("SomeConflictedPath2", "SomeOriginalPath", ChangeEntryStatus.Modified, unmerged: true),
|
||||
new ChangeEntry("SomePath3", "SomeOriginalPath", ChangeEntryStatus.Modified),
|
||||
new ChangeEntry("SomeConflictedPath4", "SomeOriginalPath", ChangeEntryStatus.Modified, unmerged: true),
|
||||
new ChangeEntry("SomeConflictedPath5", "SomeOriginalPath", ChangeEntryStatus.Modified, unmerged: true)
|
||||
};
|
||||
|
||||
var historyChanges = new List<IChangeEntry>
|
||||
{
|
||||
new ChangeEntry("HistoryItemPath", "HistoryItemOriginalPath", ChangeEntryStatus.Modified, true)
|
||||
};
|
||||
m_History = new List<IHistoryEntry>
|
||||
{
|
||||
new HistoryEntry("HistoryItemRevisionId", HistoryEntryStatus.Current,"HistoryItemAuthorName", "HistoryItemMessage", DateTimeOffset.Now, historyChanges)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Safely delays a call onto the main thread.
|
||||
/// </summary>
|
||||
/// <param name="call">Call to delay.</param>
|
||||
static void SafeDelayCall(Action call)
|
||||
{
|
||||
Task.Delay(2000).ContinueWith(_ => EditorApplication.delayCall += () => call());
|
||||
}
|
||||
|
||||
public void SetChanges(List<IChangeEntry> changes)
|
||||
{
|
||||
m_Changes = changes;
|
||||
NotifyChanges();
|
||||
}
|
||||
|
||||
IReadOnlyList<IChangeEntry> CloneChanges()
|
||||
{
|
||||
return m_Changes.Select(item => item).ToList();
|
||||
}
|
||||
|
||||
IReadOnlyList<IHistoryEntry> CloneHistory()
|
||||
{
|
||||
return m_History.Select(item => item).ToList();
|
||||
}
|
||||
|
||||
void NotifyChanges()
|
||||
{
|
||||
UpdatedChangeList?.Invoke();
|
||||
}
|
||||
|
||||
void NotifyHistory()
|
||||
{
|
||||
UpdatedHistoryEntries?.Invoke();
|
||||
}
|
||||
|
||||
public bool GetRemoteRevisionAvailability()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GetConflictedState()
|
||||
{
|
||||
return m_Changes.Any(e => e.Unmerged);
|
||||
}
|
||||
|
||||
public IProgressInfo GetProgressState()
|
||||
{
|
||||
return new ProgressInfo();
|
||||
}
|
||||
|
||||
public IErrorInfo GetErrorState()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public ProjectStatus GetProjectStatus()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChangeList(Action<IReadOnlyList<IChangeEntry>> callback)
|
||||
{
|
||||
callback(CloneChanges());
|
||||
}
|
||||
|
||||
public void RequestPublish(string message, IReadOnlyList<IChangeEntry> changes = null)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestHistoryEntry(string revisionId, Action<IHistoryEntry> callback)
|
||||
{
|
||||
SafeDelayCall(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
callback(CloneHistory().FirstOrDefault(e => e.RevisionId == revisionId));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
callback(CloneHistory().FirstOrDefault(i => i.RevisionId == revisionId));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void RequestHistoryPage(int offset, int pageSize, Action<IReadOnlyList<IHistoryEntry>> callback)
|
||||
{
|
||||
var safeSize = Math.Min(m_History.Count - offset, pageSize);
|
||||
SafeDelayCall(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Assert.Greater(m_History.Count, offset, "The offset should never be greater than the total number of history entries.");
|
||||
callback(CloneHistory().ToList().GetRange(offset, safeSize));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void RequestHistoryCount(Action<int?> callback)
|
||||
{
|
||||
SafeDelayCall(() => callback(m_History.Count));
|
||||
}
|
||||
|
||||
public void RequestDiscard(IChangeEntry entry)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestBulkDiscard(IReadOnlyList<IChangeEntry> entries)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestDiffChanges(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool SupportsRevert { get; } = false;
|
||||
public void RequestRevert(string revisionId, IReadOnlyList<string> files)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestUpdateTo(string revisionId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestRestoreTo(string revisionId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestGoBackTo(string revisionId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ClearError()
|
||||
{
|
||||
}
|
||||
|
||||
public void RequestShowConflictedDifferences(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChooseMerge(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChooseMine(string[] paths)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChooseRemote(string[] paths)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestSync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestCancelJob()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestTurnOnService()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ShowServicePage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ShowLoginPage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ShowNoSeatPage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c1a720a51e44604479a70a6a175aac0b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,191 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using Unity.Cloud.Collaborate.Models.Enums;
|
||||
using Unity.Cloud.Collaborate.Models.Providers;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Tests.Models
|
||||
{
|
||||
internal class StartModelTests
|
||||
{
|
||||
TestCollab m_Provider;
|
||||
AsyncToCoroutine m_Atc;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void OneTimeSetup()
|
||||
{
|
||||
m_Atc = new AsyncToCoroutine();
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
m_Provider = new TestCollab();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
m_Provider = null;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator TestWhenProjectBoundSavesAssets()
|
||||
{
|
||||
return m_Atc.Run(async () =>
|
||||
{
|
||||
var saveAssetsCallCount = 0;
|
||||
|
||||
//ensure we return true for isProjectBound
|
||||
m_Provider.isProjectBoundTestImpl = () => ProjectStatus.Bound;
|
||||
m_Provider.saveAssetsTestImpl = () => saveAssetsCallCount++;
|
||||
|
||||
saveAssetsCallCount.ShouldBe(0);
|
||||
await m_Provider.TestRequestTurnOnService();
|
||||
saveAssetsCallCount.ShouldBe(1, $"Expected {nameof(saveAssetsCallCount)} to be 1");
|
||||
});
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator TestWhenGenesisReturnsForbiddenShowsCredentialsError()
|
||||
{
|
||||
return m_Atc.Run(async () =>
|
||||
{
|
||||
var showCredentialsErrorCallCount = 0;
|
||||
var putAsyncCallCount = 0;
|
||||
|
||||
//ensure we return true for isProjectBound
|
||||
m_Provider.isProjectBoundTestImpl = () => ProjectStatus.Bound;
|
||||
m_Provider.showCredentialsErrorTestImpl = () => showCredentialsErrorCallCount++;
|
||||
|
||||
m_Provider.putAsyncTestImpl = () =>
|
||||
{
|
||||
putAsyncCallCount++;
|
||||
return Task.Run(() => new HttpResponseMessage(HttpStatusCode.Forbidden));
|
||||
};
|
||||
|
||||
putAsyncCallCount.ShouldBe(0);
|
||||
showCredentialsErrorCallCount.ShouldBe(0);
|
||||
await m_Provider.TestRequestTurnOnService();
|
||||
|
||||
putAsyncCallCount.ShouldBe(1, $"Expected {nameof(putAsyncCallCount)} to be 1");
|
||||
showCredentialsErrorCallCount.ShouldBe(1, $"Expected {nameof(showCredentialsErrorCallCount)} to be 1");
|
||||
});
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator TestsWhenGenesisReturnsErrorShowsGenericError()
|
||||
{
|
||||
return m_Atc.Run(async () =>
|
||||
{
|
||||
var showGeneralErrorCallCount = 0;
|
||||
var putAsyncCallCount = 0;
|
||||
|
||||
//ensure we return true for isProjectBound
|
||||
m_Provider.isProjectBoundTestImpl = () => ProjectStatus.Bound;
|
||||
m_Provider.showGeneralErrorTestImpl = () =>
|
||||
{
|
||||
showGeneralErrorCallCount++;
|
||||
};
|
||||
|
||||
m_Provider.putAsyncTestImpl = () =>
|
||||
{
|
||||
putAsyncCallCount++;
|
||||
return Task.Run(() => new HttpResponseMessage(HttpStatusCode.NotFound));
|
||||
};
|
||||
|
||||
putAsyncCallCount.ShouldBe(0);
|
||||
showGeneralErrorCallCount.ShouldBe(0);
|
||||
await m_Provider.TestRequestTurnOnService();
|
||||
putAsyncCallCount.ShouldBe(1, $"Expected {nameof(putAsyncCallCount)} to be 1");
|
||||
showGeneralErrorCallCount.ShouldBe(1, $"Expected {nameof(showGeneralErrorCallCount)} to be 1");
|
||||
});
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator TestWhenGenesisReturnsOkCallsTurnOnCollabInternal()
|
||||
{
|
||||
return m_Atc.Run(async () =>
|
||||
{
|
||||
var putAsyncCallCount = 0;
|
||||
var turnOnCollabInternalCallCount = 0;
|
||||
|
||||
// Ensure we return true for isProjectBound.
|
||||
m_Provider.isProjectBoundTestImpl = () => ProjectStatus.Bound;
|
||||
m_Provider.turnOnCollabInternalTestImpl = () => turnOnCollabInternalCallCount++;
|
||||
|
||||
m_Provider.putAsyncTestImpl = () =>
|
||||
{
|
||||
putAsyncCallCount++;
|
||||
return Task.Run(() => new HttpResponseMessage(HttpStatusCode.OK));
|
||||
};
|
||||
|
||||
putAsyncCallCount.ShouldBe(0);
|
||||
turnOnCollabInternalCallCount.ShouldBe(0);
|
||||
await m_Provider.TestRequestTurnOnService();
|
||||
putAsyncCallCount.ShouldBe(1, $"Expected {nameof(putAsyncCallCount)} to be 1");
|
||||
turnOnCollabInternalCallCount.ShouldBe(1, $"Expected {nameof(turnOnCollabInternalCallCount)} to be 1");
|
||||
});
|
||||
}
|
||||
|
||||
class TestCollab : Collab
|
||||
{
|
||||
public Func<ProjectStatus> isProjectBoundTestImpl;
|
||||
public Action saveAssetsTestImpl;
|
||||
public Action turnOnCollabInternalTestImpl;
|
||||
public Func<Task<HttpResponseMessage>> putAsyncTestImpl;
|
||||
public Action showCredentialsErrorTestImpl;
|
||||
public Action showGeneralErrorTestImpl;
|
||||
|
||||
public TestCollab()
|
||||
{
|
||||
isProjectBoundTestImpl = () => ProjectStatus.Unbound;
|
||||
saveAssetsTestImpl = () => { };
|
||||
turnOnCollabInternalTestImpl = () => { };
|
||||
showCredentialsErrorTestImpl = () => { };
|
||||
showGeneralErrorTestImpl = () => { };
|
||||
|
||||
putAsyncTestImpl = () => Task.Run(() => new HttpResponseMessage());
|
||||
}
|
||||
|
||||
public async Task TestRequestTurnOnService()
|
||||
{
|
||||
await RequestTurnOnServiceInternal();
|
||||
}
|
||||
|
||||
protected override Task<HttpResponseMessage> PutAsync(HttpClient client, string fullUrl, StringContent content)
|
||||
{
|
||||
return putAsyncTestImpl?.Invoke();
|
||||
}
|
||||
|
||||
protected override void TurnOnCollabInternal()
|
||||
{
|
||||
turnOnCollabInternalTestImpl?.Invoke();
|
||||
}
|
||||
|
||||
protected override void SaveAssets()
|
||||
{
|
||||
saveAssetsTestImpl?.Invoke();
|
||||
}
|
||||
|
||||
public override ProjectStatus GetProjectStatus()
|
||||
{
|
||||
return isProjectBoundTestImpl?.Invoke() ?? ProjectStatus.Unbound;
|
||||
}
|
||||
|
||||
protected override void ShowCredentialsError()
|
||||
{
|
||||
showCredentialsErrorTestImpl?.Invoke();
|
||||
}
|
||||
|
||||
protected override void ShowGeneralError()
|
||||
{
|
||||
showGeneralErrorTestImpl?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/StartModelTests.cs.meta
generated
Normal file
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/StartModelTests.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 65dbc1a79b82e2b49884dcc702396733
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,192 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Cloud.Collaborate.Models;
|
||||
using Unity.Cloud.Collaborate.Models.Structures;
|
||||
using Unity.Cloud.Collaborate.UserInterface;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Tests.Models
|
||||
{
|
||||
internal class TestChangesModel : IChangesModel
|
||||
{
|
||||
public int UpdateEntryToggleCount;
|
||||
public string UpdateEntryTogglePath;
|
||||
public bool? UpdateEntryToggleValue;
|
||||
|
||||
public int GetToggledEntriesCount;
|
||||
public string GetToggledEntriesQuery;
|
||||
|
||||
public int GetUntoggledEntriesCount;
|
||||
public string GetUntoggledEntriesQuery;
|
||||
|
||||
public int GetAllEntriesCount;
|
||||
public string GetAllEntriesQuery;
|
||||
|
||||
public int GetConflictedEntriesCount;
|
||||
public string GetConflictedEntriesQuery;
|
||||
|
||||
public int RequestInitialDataCount;
|
||||
|
||||
public int RequestDiscardCount;
|
||||
public IChangeEntry RequestDiscardEntry;
|
||||
|
||||
public int RequestBulkDiscardCount;
|
||||
public IReadOnlyList<IChangeEntry> RequestBulkDiscardPaths;
|
||||
|
||||
public int RequestDiffCount;
|
||||
public string RequestDiffPath;
|
||||
|
||||
public int RequestPublishCount;
|
||||
public IReadOnlyList<IChangeEntry> RequestPublishList;
|
||||
|
||||
public IReadOnlyList<IChangeEntryData> UntoggledEntries = new List<IChangeEntryData>();
|
||||
public IReadOnlyList<IChangeEntryData> ToggledEntries = new List<IChangeEntryData>();
|
||||
public IReadOnlyList<IChangeEntryData> AllEntries = new List<IChangeEntryData>();
|
||||
public IReadOnlyList<IChangeEntryData> ConflictedEntries = new List<IChangeEntryData>();
|
||||
|
||||
public event Action UpdatedChangeList = delegate { };
|
||||
|
||||
public event Action<bool> BusyStatusUpdated = delegate { };
|
||||
|
||||
public event Action OnUpdatedSelectedChanges = delegate { };
|
||||
|
||||
public event Action StateChanged = delegate { };
|
||||
|
||||
public string SavedRevisionSummary { get; set; } = "";
|
||||
|
||||
public string SavedSearchQuery { get; set; } = "";
|
||||
|
||||
public int ToggledCount => ToggledEntries.Count;
|
||||
|
||||
public int TotalCount => AllEntries.Count;
|
||||
|
||||
public int ConflictedCount => ConflictedEntries.Count;
|
||||
|
||||
public bool Conflicted => ConflictedCount != 0;
|
||||
|
||||
public bool Busy { get; set; }
|
||||
|
||||
public void TriggerUpdatedChangeList()
|
||||
{
|
||||
UpdatedChangeList();
|
||||
}
|
||||
|
||||
public void TriggerBusyStatusUpdated(bool value)
|
||||
{
|
||||
BusyStatusUpdated(value);
|
||||
}
|
||||
|
||||
public bool UpdateEntryToggle(string path, bool toggled)
|
||||
{
|
||||
UpdateEntryToggleCount++;
|
||||
UpdateEntryTogglePath = path;
|
||||
UpdateEntryToggleValue = toggled;
|
||||
return false;
|
||||
}
|
||||
|
||||
public IReadOnlyList<IChangeEntryData> GetToggledEntries(string query = null)
|
||||
{
|
||||
GetToggledEntriesCount++;
|
||||
GetToggledEntriesQuery = query;
|
||||
return ToggledEntries;
|
||||
}
|
||||
|
||||
public IReadOnlyList<IChangeEntryData> GetUntoggledEntries(string query = null)
|
||||
{
|
||||
GetUntoggledEntriesCount++;
|
||||
GetUntoggledEntriesQuery = query;
|
||||
return UntoggledEntries;
|
||||
}
|
||||
|
||||
public IReadOnlyList<IChangeEntryData> GetAllEntries(string query = null)
|
||||
{
|
||||
GetAllEntriesCount++;
|
||||
GetAllEntriesQuery = query;
|
||||
return AllEntries;
|
||||
}
|
||||
|
||||
public IReadOnlyList<IChangeEntryData> GetConflictedEntries(string query = null)
|
||||
{
|
||||
GetConflictedEntriesCount++;
|
||||
GetConflictedEntriesQuery = query;
|
||||
return ConflictedEntries;
|
||||
}
|
||||
|
||||
public void RequestInitialData()
|
||||
{
|
||||
RequestInitialDataCount++;
|
||||
}
|
||||
|
||||
public void RequestDiffChanges(string path)
|
||||
{
|
||||
RequestDiffCount++;
|
||||
RequestDiffPath = path;
|
||||
}
|
||||
|
||||
public void RequestDiscard(IChangeEntry entry)
|
||||
{
|
||||
RequestDiscardCount++;
|
||||
RequestDiscardEntry = entry;
|
||||
}
|
||||
|
||||
public void RequestBulkDiscard(IReadOnlyList<IChangeEntry> paths)
|
||||
{
|
||||
RequestBulkDiscardCount++;
|
||||
RequestBulkDiscardPaths = paths;
|
||||
}
|
||||
|
||||
public void RequestPublish(string message, IReadOnlyList<IChangeEntry> changes = null)
|
||||
{
|
||||
RequestPublishCount++;
|
||||
RequestPublishList = changes;
|
||||
}
|
||||
|
||||
public void RequestShowConflictedDifferences(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChooseMerge(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChooseMine(string[] paths)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChooseRemote(string[] paths)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
internal class ChangeEntryData : IChangeEntryData
|
||||
{
|
||||
public IChangeEntry Entry { get; set; }
|
||||
public bool Toggled { get; set; }
|
||||
public bool All { get; set; }
|
||||
public bool ToggleReadOnly { get; set; }
|
||||
public bool Conflicted { get; set; }
|
||||
}
|
||||
|
||||
public void OnStart()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void OnStop()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RestoreState(IWindowCache cache)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveState(IWindowCache cache)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestChangesModel.cs.meta
generated
Normal file
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestChangesModel.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8b25b386ca61a6d4d97a654fd3e5b96d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,127 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using NUnit.Framework;
|
||||
using Unity.Cloud.Collaborate.Models;
|
||||
using Unity.Cloud.Collaborate.Models.Structures;
|
||||
using Unity.Cloud.Collaborate.UserInterface;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Tests.Models
|
||||
{
|
||||
internal class TestHistoryModel : IHistoryModel
|
||||
{
|
||||
public event Action HistoryListUpdated = delegate { };
|
||||
public event Action<IReadOnlyList<IHistoryEntry>> HistoryListReceived = delegate { };
|
||||
public event Action<IHistoryEntry> SelectedRevisionReceived = delegate { };
|
||||
public event Action<bool> BusyStatusUpdated = delegate { };
|
||||
public event Action<int?> EntryCountUpdated = delegate { };
|
||||
public event Action StateChanged = delegate { };
|
||||
|
||||
public int RequestedPageOfRevisionsCount;
|
||||
public int RequestedPageSize;
|
||||
|
||||
public int RequestedSingleRevisionCount;
|
||||
[CanBeNull]
|
||||
public string RequestedRevisionId;
|
||||
|
||||
public int RequestedEntryCountCount;
|
||||
|
||||
public int RequestedUpdateToCount;
|
||||
[CanBeNull]
|
||||
public string RequestedUpdateToRevisionId;
|
||||
|
||||
public int RequestedRestoreToCount;
|
||||
[CanBeNull]
|
||||
public string RequestedRestoreToRevisionId;
|
||||
|
||||
public int RequestedGoBackToCount;
|
||||
[CanBeNull]
|
||||
public string RequestedGoBackToRevisionId;
|
||||
|
||||
public int RequestedRevertCount;
|
||||
[CanBeNull]
|
||||
public string RequestedRevertRevisionId;
|
||||
public int RequestedRevertFileCount;
|
||||
|
||||
public void SetNumberOfEntries(int count)
|
||||
{
|
||||
Assert.NotNull(EntryCountUpdated, "There should be an receiver for the entry number count event.");
|
||||
EntryCountUpdated.Invoke(count);
|
||||
}
|
||||
|
||||
public void TriggerUpdatedEntryListEvent()
|
||||
{
|
||||
Assert.NotNull(HistoryListUpdated, "There should be an receiver for the history list updated event.");
|
||||
HistoryListUpdated();
|
||||
}
|
||||
|
||||
public bool Busy { get; set; }
|
||||
public int PageNumber { get; set; }
|
||||
public string SelectedRevisionId { get; set; }
|
||||
public string SavedRevisionId { get; set; }
|
||||
public bool IsRevisionSelected => !string.IsNullOrEmpty(SelectedRevisionId);
|
||||
|
||||
public void RequestPageOfRevisions(int pageSize)
|
||||
{
|
||||
RequestedPageSize = pageSize;
|
||||
RequestedPageOfRevisionsCount++;
|
||||
}
|
||||
|
||||
public void RequestSingleRevision(string revisionId)
|
||||
{
|
||||
RequestedRevisionId = revisionId;
|
||||
RequestedSingleRevisionCount++;
|
||||
}
|
||||
|
||||
public void RequestEntryNumber()
|
||||
{
|
||||
RequestedEntryCountCount++;
|
||||
}
|
||||
|
||||
public void RequestUpdateTo(string revisionId)
|
||||
{
|
||||
RequestedUpdateToCount++;
|
||||
RequestedUpdateToRevisionId = revisionId;
|
||||
}
|
||||
|
||||
public void RequestRestoreTo(string revisionId)
|
||||
{
|
||||
RequestedRestoreToCount++;
|
||||
RequestedRestoreToRevisionId = revisionId;
|
||||
}
|
||||
|
||||
public void RequestGoBackTo(string revisionId)
|
||||
{
|
||||
RequestedGoBackToCount++;
|
||||
RequestedGoBackToRevisionId = revisionId;
|
||||
}
|
||||
|
||||
public bool SupportsRevert { get; } = false;
|
||||
public void RequestRevert(string revisionId, IReadOnlyList<string> files)
|
||||
{
|
||||
RequestedRevertCount++;
|
||||
RequestedRevertRevisionId = revisionId;
|
||||
RequestedRevertFileCount = files.Count;
|
||||
}
|
||||
|
||||
public void OnStart()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void OnStop()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RestoreState(IWindowCache cache)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveState(IWindowCache cache)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestHistoryModel.cs.meta
generated
Normal file
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestHistoryModel.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f56a99fa7c9121f46a7915e03de4d0a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,138 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
using Unity.Cloud.Collaborate.Models;
|
||||
using Unity.Cloud.Collaborate.Models.Structures;
|
||||
using Unity.Cloud.Collaborate.UserInterface;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Tests.Models
|
||||
{
|
||||
internal class TestMainModel : IMainModel
|
||||
{
|
||||
public int clearErrorCount;
|
||||
public int requestSyncCount;
|
||||
public int requestCancelJobCount;
|
||||
|
||||
public IHistoryModel historyModel = new TestHistoryModel();
|
||||
public IChangesModel changesModel = new TestChangesModel();
|
||||
|
||||
public (string id, string text, Action backAction)? backNavigation;
|
||||
|
||||
public event Action<bool> ConflictStatusChange = delegate { };
|
||||
public void TriggerConflictStatusChange(bool conflict)
|
||||
{
|
||||
ConflictStatusChange(conflict);
|
||||
}
|
||||
|
||||
public event Action<bool> OperationStatusChange = delegate { };
|
||||
public void TriggerOperationStatusChange(bool inProgress)
|
||||
{
|
||||
OperationStatusChange(inProgress);
|
||||
}
|
||||
|
||||
public event Action<IProgressInfo> OperationProgressChange = delegate { };
|
||||
public void TriggerOperationProgressChange(IProgressInfo progressInfo)
|
||||
{
|
||||
OperationProgressChange(progressInfo);
|
||||
}
|
||||
|
||||
public event Action<IErrorInfo> ErrorOccurred = delegate { };
|
||||
public void TriggerErrorOccurred(IErrorInfo errorInfo)
|
||||
{
|
||||
ErrorOccurred(errorInfo);
|
||||
}
|
||||
|
||||
public event Action ErrorCleared = delegate { };
|
||||
public void TriggerErrorCleared()
|
||||
{
|
||||
ErrorCleared();
|
||||
}
|
||||
|
||||
public event Action<bool> RemoteRevisionsAvailabilityChange = delegate { };
|
||||
public void TriggerRemoteRevisionsAvailabilityChange(bool available)
|
||||
{
|
||||
RemoteRevisionsAvailabilityChange(available);
|
||||
}
|
||||
|
||||
public event Action<string> BackButtonStateUpdated = delegate { };
|
||||
public void TriggerBackButtonStateUpdated(string backText)
|
||||
{
|
||||
BackButtonStateUpdated(backText);
|
||||
}
|
||||
|
||||
public event Action StateChanged = delegate { };
|
||||
public void TriggerStateChanged()
|
||||
{
|
||||
StateChanged();
|
||||
}
|
||||
|
||||
public bool RemoteRevisionsAvailable { get; set; }
|
||||
public bool Conflicted { get; set; }
|
||||
public IProgressInfo ProgressInfo { get; set; }
|
||||
public IErrorInfo ErrorInfo { get; set; }
|
||||
public int CurrentTabIndex { get; set; }
|
||||
|
||||
public IHistoryModel ConstructHistoryModel()
|
||||
{
|
||||
return historyModel;
|
||||
}
|
||||
|
||||
public IChangesModel ConstructChangesModel()
|
||||
{
|
||||
return changesModel;
|
||||
}
|
||||
|
||||
public void ClearError()
|
||||
{
|
||||
clearErrorCount++;
|
||||
}
|
||||
|
||||
public void RequestSync()
|
||||
{
|
||||
requestSyncCount++;
|
||||
}
|
||||
|
||||
public void RequestCancelJob()
|
||||
{
|
||||
requestCancelJobCount++;
|
||||
}
|
||||
|
||||
public (string id, string text, Action backAction)? GetBackNavigation()
|
||||
{
|
||||
return backNavigation;
|
||||
}
|
||||
|
||||
public void RegisterBackNavigation(string id, string text, Action backAction)
|
||||
{
|
||||
Assert.IsNull(backNavigation);
|
||||
backNavigation = (id, text, backAction);
|
||||
}
|
||||
|
||||
public bool UnregisterBackNavigation(string id)
|
||||
{
|
||||
if (backNavigation == null || backNavigation.Value.id != id)
|
||||
return false;
|
||||
backNavigation = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnStart()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void OnStop()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RestoreState(IWindowCache cache)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveState(IWindowCache cache)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestMainModel.cs.meta
generated
Normal file
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestMainModel.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e47743db60d9e3e48b0a6fa8c0b95640
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,248 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using NUnit.Framework;
|
||||
using Unity.Cloud.Collaborate.Models.Api;
|
||||
using Unity.Cloud.Collaborate.Models.Enums;
|
||||
using Unity.Cloud.Collaborate.Models.Structures;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Tests.Models
|
||||
{
|
||||
internal class TestSourceControlProvider : ISourceControlProvider
|
||||
{
|
||||
public int RequestedHistoryRevisionCount;
|
||||
[CanBeNull]
|
||||
public string RequestedHistoryRevisionId;
|
||||
|
||||
public int RequestedHistoryListCount;
|
||||
public int? RequestedHistoryListOffset;
|
||||
public int? RequestedHistoryListSize;
|
||||
|
||||
public int RequestedHistoryCountCount;
|
||||
|
||||
public int RequestedUpdateToCount;
|
||||
[CanBeNull]
|
||||
public string RequestedUpdateToRevisionId;
|
||||
|
||||
public int RequestedRestoreToCount;
|
||||
[CanBeNull]
|
||||
public string RequestedRestoreToRevisionId;
|
||||
|
||||
public int RequestedGoBackToCount;
|
||||
[CanBeNull]
|
||||
public string RequestedGoBackToRevisionId;
|
||||
|
||||
public int RequestedRevertCount;
|
||||
[CanBeNull]
|
||||
public string RequestedRevertRevisionId;
|
||||
public int? RequestedRevertFileCount;
|
||||
|
||||
public int RequestedChangeListCount;
|
||||
[CanBeNull]
|
||||
public Action<IReadOnlyList<IChangeEntry>> RequestedChangeListCallback;
|
||||
|
||||
public int RequestedDiscardCount;
|
||||
[CanBeNull]
|
||||
public IChangeEntry RequestedDiscardEntry;
|
||||
|
||||
public int RequestedBulkDiscardCount;
|
||||
[CanBeNull]
|
||||
public IReadOnlyList<IChangeEntry> RequestedBulkDiscardPaths;
|
||||
|
||||
public int RequestedDiffChangesCount;
|
||||
[CanBeNull]
|
||||
public string RequestedDiffChangesPath;
|
||||
|
||||
public int RequestedPublishCount;
|
||||
[CanBeNull]
|
||||
public string RequestedPublishMessage;
|
||||
[CanBeNull]
|
||||
public IReadOnlyList<IChangeEntry> RequestedPublishList;
|
||||
|
||||
public bool RemoteRevisionAvailability = false;
|
||||
|
||||
public bool ConflictedState = false;
|
||||
|
||||
public event Action UpdatedChangeList = delegate { };
|
||||
public event Action UpdatedHistoryEntries = delegate { };
|
||||
public event Action<bool> UpdatedConflictState = delegate { };
|
||||
public event Action<bool> UpdatedRemoteRevisionsAvailability = delegate { };
|
||||
public event Action<ProjectStatus> UpdatedProjectStatus = delegate { };
|
||||
|
||||
public event Action<bool> UpdatedOperationStatus = delegate { };
|
||||
public event Action<IProgressInfo> UpdatedOperationProgress = delegate { };
|
||||
|
||||
public event Action<IErrorInfo> ErrorOccurred = delegate { };
|
||||
public event Action ErrorCleared = delegate { };
|
||||
public event Action<IReadOnlyList<string>> UpdatedSelectedChangeList = delegate { };
|
||||
|
||||
public bool GetRemoteRevisionAvailability()
|
||||
{
|
||||
return RemoteRevisionAvailability;
|
||||
}
|
||||
|
||||
public bool GetConflictedState()
|
||||
{
|
||||
return ConflictedState;
|
||||
}
|
||||
|
||||
public IProgressInfo GetProgressState()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IErrorInfo GetErrorState()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public ProjectStatus GetProjectStatus()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChangeList(Action<IReadOnlyList<IChangeEntry>> callback)
|
||||
{
|
||||
RequestedChangeListCount++;
|
||||
RequestedChangeListCallback = callback;
|
||||
}
|
||||
|
||||
public void RequestPublish(string message, IReadOnlyList<IChangeEntry> changes = null)
|
||||
{
|
||||
RequestedPublishCount++;
|
||||
RequestedPublishMessage = message;
|
||||
RequestedPublishList = changes;
|
||||
}
|
||||
|
||||
public void TriggerUpdatedHistoryEntries()
|
||||
{
|
||||
Assert.NotNull(UpdatedHistoryEntries, "There should be a listener registered.");
|
||||
UpdatedHistoryEntries();
|
||||
}
|
||||
|
||||
public void TriggerUpdatedChangeEntries()
|
||||
{
|
||||
Assert.NotNull(UpdatedHistoryEntries, "There should be a listener registered.");
|
||||
UpdatedChangeList();
|
||||
}
|
||||
|
||||
public void RequestHistoryEntry(string revisionId, Action<IHistoryEntry> callback)
|
||||
{
|
||||
RequestedHistoryRevisionCount++;
|
||||
RequestedHistoryRevisionId = revisionId;
|
||||
callback(null);
|
||||
}
|
||||
|
||||
public void RequestHistoryPage(int offset, int pageSize, Action<IReadOnlyList<IHistoryEntry>> callback)
|
||||
{
|
||||
RequestedHistoryListCount++;
|
||||
RequestedHistoryListOffset = offset;
|
||||
RequestedHistoryListSize = pageSize;
|
||||
callback(null);
|
||||
}
|
||||
|
||||
public void RequestHistoryCount(Action<int?> callback)
|
||||
{
|
||||
RequestedHistoryCountCount++;
|
||||
callback(null);
|
||||
}
|
||||
|
||||
public void RequestDiscard(IChangeEntry entry)
|
||||
{
|
||||
RequestedDiscardCount++;
|
||||
RequestedDiscardEntry = entry;
|
||||
}
|
||||
|
||||
public void RequestBulkDiscard(IReadOnlyList<IChangeEntry> entries)
|
||||
{
|
||||
RequestedBulkDiscardCount++;
|
||||
RequestedBulkDiscardPaths = entries;
|
||||
}
|
||||
|
||||
public void RequestDiffChanges(string path)
|
||||
{
|
||||
RequestedDiffChangesCount++;
|
||||
RequestedDiffChangesPath = path;
|
||||
}
|
||||
|
||||
public bool SupportsRevert { get; } = false;
|
||||
public void RequestRevert(string revisionId, IReadOnlyList<string> files)
|
||||
{
|
||||
RequestedRevertCount++;
|
||||
RequestedRevertRevisionId = revisionId;
|
||||
RequestedRevertFileCount = files.Count;
|
||||
}
|
||||
|
||||
public void RequestUpdateTo(string revisionId)
|
||||
{
|
||||
RequestedUpdateToCount++;
|
||||
RequestedUpdateToRevisionId = revisionId;
|
||||
}
|
||||
|
||||
public void RequestRestoreTo(string revisionId)
|
||||
{
|
||||
RequestedRestoreToCount++;
|
||||
RequestedRestoreToRevisionId = revisionId;
|
||||
}
|
||||
|
||||
public void RequestGoBackTo(string revisionId)
|
||||
{
|
||||
RequestedGoBackToCount++;
|
||||
RequestedGoBackToRevisionId = revisionId;
|
||||
}
|
||||
|
||||
public void ClearError()
|
||||
{
|
||||
}
|
||||
|
||||
public void RequestShowConflictedDifferences(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChooseMerge(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChooseMine(string[] paths)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestChooseRemote(string[] paths)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestSync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestCancelJob()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestTurnOnService()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ShowServicePage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ShowLoginPage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ShowNoSeatPage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fb18ae523e202db40a866e7813fa2c0c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using Unity.Cloud.Collaborate.Models;
|
||||
using Unity.Cloud.Collaborate.Models.Enums;
|
||||
using Unity.Cloud.Collaborate.UserInterface;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Tests.Models
|
||||
{
|
||||
internal class TestStartModel : IStartModel
|
||||
{
|
||||
public int requestTurnOnServiceCount;
|
||||
public int showServicePageCount;
|
||||
public int showLoginPageCount;
|
||||
public int showNoSeatPageCount;
|
||||
|
||||
public event Action StateChanged = delegate { };
|
||||
public void TriggerStateChanged()
|
||||
{
|
||||
StateChanged();
|
||||
}
|
||||
|
||||
public event Action<ProjectStatus> ProjectStatusChanged = delegate { };
|
||||
public void TriggerProjectStatusChanged(ProjectStatus status)
|
||||
{
|
||||
ProjectStatusChanged(status);
|
||||
}
|
||||
|
||||
public ProjectStatus ProjectStatus { get; set; }
|
||||
|
||||
public void OnStart()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void OnStop()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RestoreState(IWindowCache cache)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveState(IWindowCache cache)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RequestTurnOnService()
|
||||
{
|
||||
requestTurnOnServiceCount++;
|
||||
}
|
||||
|
||||
public void ShowServicePage()
|
||||
{
|
||||
showServicePageCount++;
|
||||
}
|
||||
|
||||
public void ShowLoginPage()
|
||||
{
|
||||
showLoginPageCount++;
|
||||
}
|
||||
|
||||
public void ShowNoSeatPage()
|
||||
{
|
||||
showNoSeatPageCount++;
|
||||
}
|
||||
}
|
||||
}
|
3
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestStartModel.cs.meta
generated
Normal file
3
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestStartModel.cs.meta
generated
Normal file
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 49d15206774f47cab3c22a97f27bf8ec
|
||||
timeCreated: 1576186334
|
|
@ -0,0 +1,24 @@
|
|||
using Unity.Cloud.Collaborate.UserInterface;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Tests.Models
|
||||
{
|
||||
internal class TestWindowCache : IWindowCache
|
||||
{
|
||||
public void Clear()
|
||||
{
|
||||
SimpleSelectedItems = default;
|
||||
RevisionSummary = default;
|
||||
ChangesSearchValue = default;
|
||||
SelectedHistoryRevision = default;
|
||||
HistoryPageNumber = default;
|
||||
TabIndex = default;
|
||||
}
|
||||
|
||||
public SelectedItemsDictionary SimpleSelectedItems { get; set; }
|
||||
public string RevisionSummary { get; set; }
|
||||
public string ChangesSearchValue { get; set; }
|
||||
public string SelectedHistoryRevision { get; set; }
|
||||
public int HistoryPageNumber { get; set; }
|
||||
public int TabIndex { get; set; }
|
||||
}
|
||||
}
|
3
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestWindowCache.cs.meta
generated
Normal file
3
Library/PackageCache/com.unity.collab-proxy@1.3.9/Tests/Editor/Models/TestWindowCache.cs.meta
generated
Normal file
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: acd046f16a9a499699c470bf320ab6be
|
||||
timeCreated: 1574115275
|
Loading…
Add table
Add a link
Reference in a new issue