| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- 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();
- }
- }
- }
|