Skip to content

Commit

Permalink
SLVS-1487 Ensure initialization of ManageBindingDialog will never crash
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriela-trutan-sonarsource committed Oct 11, 2024
1 parent 55c4355 commit 97f6d5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,16 @@ await progressReporterViewModel.Received(1)
x.AfterProgressUpdated == testSubject.OnProgressUpdated));
}

[TestMethod]
public async Task InitializeDataAsync_ShouldNotThrow_WhenDetectingSharedBindingConfigThrows()
{
sharedBindingConfigProvider.GetSharedBinding().Throws(new Exception("Failed to detect shared binding"));

var act = async ()=> await testSubject.InitializeDataAsync();

await act.Should().NotThrowAsync();
}

[TestMethod]
public async Task DisplayBindStatusAsync_WhenProjectIsNotBound_Succeeds()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public async Task InitializeDataAsync()
var displayBindStatus = new TaskToPerformParams<AdapterResponse>(DisplayBindStatusAsync, UiResources.FetchingBindingStatusText,
UiResources.FetchingBindingStatusFailedText) { AfterProgressUpdated = OnProgressUpdated};
await ProgressReporter.ExecuteTaskWithProgressAsync(displayBindStatus);
DetectSharedBinding();
}

public async Task BindWithProgressAsync()
Expand Down Expand Up @@ -268,6 +267,7 @@ internal bool LoadConnections()
SelectedConnectionInfo = ConnectionInfo.From(serverConnection);
SelectedProject = response.ResponseData;
BoundProject = SelectedProject;
DetectSharedBinding();
return new AdapterResponse(BoundProject != null);
}

Expand Down

0 comments on commit 97f6d5e

Please sign in to comment.