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

SLVS-1721 Fix "Use shared configuration" button not shown after unbind #5907

Merged
merged 1 commit into from
Dec 18, 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
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,42 @@ public void IsUseSharedBindingButtonEnabled_ReturnsTrueOnlyWhenNoBindingIsInProg
testSubject.IsUseSharedBindingButtonEnabled.Should().Be(expectedResult);
}

[TestMethod]
public void IsUseSharedBindingButtonVisible_SharedBindingConfigExistsAndProjectIsBound_ReturnsFalse()
{
testSubject.SharedBindingConfigModel = new SharedBindingConfigModel();
testSubject.BoundProject = serverProject;

testSubject.IsUseSharedBindingButtonVisible.Should().BeFalse();
}

[TestMethod]
public void IsUseSharedBindingButtonVisible_SharedBindingConfigExistsAndProjectIsUnbound_ReturnsTrue()
{
testSubject.SharedBindingConfigModel = new SharedBindingConfigModel();
testSubject.BoundProject = null;

testSubject.IsUseSharedBindingButtonVisible.Should().BeTrue();
}

[TestMethod]
public void IsUseSharedBindingButtonVisible_SharedBindingConfigDoesNotExistAndProjectIsBound_ReturnsFalse()
{
testSubject.SharedBindingConfigModel = null;
testSubject.BoundProject = serverProject;

testSubject.IsUseSharedBindingButtonVisible.Should().BeFalse();
}

[TestMethod]
public void IsUseSharedBindingButtonVisible_SharedBindingConfigDoesNotExistAndProjectIsUnbound_ReturnsFalse()
{
testSubject.SharedBindingConfigModel = null;
testSubject.BoundProject = null;

testSubject.IsUseSharedBindingButtonVisible.Should().BeFalse();
}

[TestMethod]
public void SharedBindingConfigModel_Set_RaisesEvents()
{
Expand Down Expand Up @@ -584,13 +620,13 @@ await progressReporterViewModel.Received(1)
}

[TestMethod]
public async Task InitializeDataAsync_WhenBound_DoesNotChecksForSharedBindingAndReportsProgress()
public async Task InitializeDataAsync_WhenBound_ChecksForSharedBindingAndReportsProgress()
{
testSubject.BoundProject = serverProject;

await testSubject.InitializeDataAsync();

await progressReporterViewModel.DidNotReceive()
await progressReporterViewModel.Received(1)
.ExecuteTaskWithProgressAsync(
Arg.Is<TaskToPerformParams<AdapterResponse>>(x =>
x.TaskToPerform == testSubject.CheckForSharedBindingAsync &&
Expand Down
10 changes: 4 additions & 6 deletions src/ConnectedMode/UI/ManageBinding/ManageBindingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,10 @@ public async Task InitializeDataAsync()
UiResources.FetchingBindingStatusFailedText) { AfterProgressUpdated = OnProgressUpdated };
await ProgressReporter.ExecuteTaskWithProgressAsync(displayBindStatus);

if (!IsCurrentProjectBound)
{
var detectSharedBinding = new TaskToPerformParams<AdapterResponse>(CheckForSharedBindingAsync, UiResources.CheckingForSharedBindingText,
UiResources.CheckingForSharedBindingFailedText) { AfterProgressUpdated = OnProgressUpdated };
await ProgressReporter.ExecuteTaskWithProgressAsync(detectSharedBinding);
}
var detectSharedBinding = new TaskToPerformParams<AdapterResponse>(CheckForSharedBindingAsync, UiResources.CheckingForSharedBindingText,
UiResources.CheckingForSharedBindingFailedText)
{ AfterProgressUpdated = OnProgressUpdated };
await ProgressReporter.ExecuteTaskWithProgressAsync(detectSharedBinding);
Comment on lines +144 to +147
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue seems to be fixed by #5906 This change can be reverted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I started with an unbound project which is not the same.

}

public async Task BindWithProgressAsync()
Expand Down
Loading