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> RequestedChangeListCallback; public int RequestedDiscardCount; [CanBeNull] public IChangeEntry RequestedDiscardEntry; public int RequestedBulkDiscardCount; [CanBeNull] public IReadOnlyList RequestedBulkDiscardPaths; public int RequestedDiffChangesCount; [CanBeNull] public string RequestedDiffChangesPath; public int RequestedPublishCount; [CanBeNull] public string RequestedPublishMessage; [CanBeNull] public IReadOnlyList RequestedPublishList; public bool RemoteRevisionAvailability = false; public bool ConflictedState = false; public event Action UpdatedChangeList = delegate { }; public event Action UpdatedHistoryEntries = delegate { }; public event Action UpdatedConflictState = delegate { }; public event Action UpdatedRemoteRevisionsAvailability = delegate { }; public event Action UpdatedProjectStatus = delegate { }; public event Action UpdatedOperationStatus = delegate { }; public event Action UpdatedOperationProgress = delegate { }; public event Action ErrorOccurred = delegate { }; public event Action ErrorCleared = delegate { }; public event Action> 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> callback) { RequestedChangeListCount++; RequestedChangeListCallback = callback; } public void RequestPublish(string message, IReadOnlyList 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 callback) { RequestedHistoryRevisionCount++; RequestedHistoryRevisionId = revisionId; callback(null); } public void RequestHistoryPage(int offset, int pageSize, Action> callback) { RequestedHistoryListCount++; RequestedHistoryListOffset = offset; RequestedHistoryListSize = pageSize; callback(null); } public void RequestHistoryCount(Action callback) { RequestedHistoryCountCount++; callback(null); } public void RequestDiscard(IChangeEntry entry) { RequestedDiscardCount++; RequestedDiscardEntry = entry; } public void RequestBulkDiscard(IReadOnlyList entries) { RequestedBulkDiscardCount++; RequestedBulkDiscardPaths = entries; } public void RequestDiffChanges(string path) { RequestedDiffChangesCount++; RequestedDiffChangesPath = path; } public bool SupportsRevert { get; } = false; public void RequestRevert(string revisionId, IReadOnlyList 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(); } } }