Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addRepo improvements #2298

Merged
merged 22 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions tools/SetupFlow/DevHome.SetupFlow.UnitTest/AddRepoDialogTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

using DevHome.Common.Extensions;
using DevHome.Common.Services;
using DevHome.SetupFlow.Models;
using DevHome.SetupFlow.Services;
using DevHome.SetupFlow.ViewModels;
Expand All @@ -25,27 +26,29 @@ public void HideRetryBannerTest()
Assert.IsTrue(addRepoViewModel.ShouldEnablePrimaryButton);
}

[TestMethod]
[UITestMethod]
[Ignore("Making a new frame throws a COM exception. Running this as UITestMethod does not help")]
public void SwitchToUrlScreenTest()
{
var addRepoViewModel = new AddRepoViewModel(TestHost.GetService<ISetupFlowStringResource>(), new List<CloningInformation>(), TestHost, Guid.NewGuid(), string.Empty, null);
var addRepoViewModel = new AddRepoViewModel(TestHost.GetService<ISetupFlowStringResource>(), new List<CloningInformation>(), TestHost, Guid.NewGuid(), null, TestHost.GetService<IDevDriveManager>());
addRepoViewModel.ChangeToUrlPage();
Assert.AreEqual(Visibility.Visible, addRepoViewModel.ShowUrlPage);
Assert.AreEqual(Visibility.Collapsed, addRepoViewModel.ShowAccountPage);
Assert.AreEqual(Visibility.Collapsed, addRepoViewModel.ShowRepoPage);
Assert.AreEqual(true, addRepoViewModel.ShowUrlPage);
Assert.AreEqual(false, addRepoViewModel.ShowAccountPage);
Assert.AreEqual(false, addRepoViewModel.ShowRepoPage);
Assert.IsTrue(addRepoViewModel.IsUrlAccountButtonChecked);
Assert.IsFalse(addRepoViewModel.IsAccountToggleButtonChecked);
Assert.IsFalse(addRepoViewModel.ShouldShowLoginUi);
}

[TestMethod]
public void SwitchToRepoScreenTest()
[Ignore("IextensionService uses Application.Current and tests break when Application.Current is used. Ignore until fixed.")]
public async Task SwitchToAccountScreenTest()
{
var addRepoViewModel = new AddRepoViewModel(TestHost.GetService<ISetupFlowStringResource>(), new List<CloningInformation>(), TestHost, Guid.NewGuid(), string.Empty, null);
addRepoViewModel.ChangeToRepoPage();
Assert.AreEqual(Visibility.Collapsed, addRepoViewModel.ShowUrlPage);
Assert.AreEqual(Visibility.Collapsed, addRepoViewModel.ShowAccountPage);
Assert.AreEqual(Visibility.Visible, addRepoViewModel.ShowRepoPage);
var addRepoViewModel = new AddRepoViewModel(TestHost.GetService<ISetupFlowStringResource>(), new List<CloningInformation>(), TestHost, Guid.NewGuid(), null, TestHost.GetService<IDevDriveManager>());
await addRepoViewModel.ChangeToAccountPageAsync();
Assert.AreEqual(false, addRepoViewModel.ShowUrlPage);
Assert.AreEqual(true, addRepoViewModel.ShowAccountPage);
Assert.AreEqual(false, addRepoViewModel.ShowRepoPage);
Assert.IsFalse(addRepoViewModel.ShouldShowLoginUi);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using DevHome.Common.Services;
using DevHome.Contracts.Services;
using DevHome.Services;
using DevHome.SetupFlow.Common.WindowsPackageManager;
using DevHome.SetupFlow.Services;
using DevHome.SetupFlow.ViewModels;
Expand Down Expand Up @@ -58,12 +59,14 @@ private IHost CreateTestHost()
services.AddSingleton<IThemeSelectorService>(ThemeSelectorService!.Object);
services.AddSingleton<ISetupFlowStringResource>(StringResource.Object);
services.AddSingleton<SetupFlowOrchestrator>(new SetupFlowOrchestrator());
services.AddSingleton<IExtensionService>(new ExtensionService());

// App-management view models
services.AddTransient<PackageViewModel>();
services.AddTransient<PackageCatalogViewModel>();
services.AddTransient<SearchViewModel>();
services.AddTransient<LoadingViewModel>();
services.AddTransient<IDevDriveManager, DevDriveManager>();

// App-management services
services.AddSingleton<IWindowsPackageManager>(WindowsPackageManager.Object);
Expand Down
1 change: 1 addition & 0 deletions tools/SetupFlow/DevHome.SetupFlow/DevHome.SetupFlow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.Labs.WinUI.Shimmer" Version="0.1.230830" />
<PackageReference Include="CommunityToolkit.WinUI.Animations" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" />
<PackageReference Include="LibGit2Sharp" Version="0.27.0-preview-0182" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal sealed class RepositoryProvider
/// <summary>
/// Dictionary with all the repositories per account.
/// </summary>
private Dictionary<IDeveloperId, IEnumerable<IRepository>> _repositories = new();
private readonly Dictionary<IDeveloperId, IEnumerable<IRepository>> _repositories = new();

/// <summary>
/// The DeveloperId provider used to log a user into an account.
Expand Down
Loading
Loading