Skip to content

Commit

Permalink
Fix #1902 - Fix query search parameters in lorawan concentrator list …
Browse files Browse the repository at this point in the history
…page (#1918)
  • Loading branch information
kbeaugrand authored Mar 18, 2023
1 parent ee40e2f commit 4dbeb05
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
{
var searchInfo = new ConcentratorSearchInfo
{
SearchKeyword = searchKeyword,
SearchStatus = searchStatus,
SearchState = searchState
SearchText = searchKeyword,
Status = searchStatus,
State = searchState
};
await OnSearch.InvokeAsync(searchInfo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace AzureIoTHub.Portal.Client.Models
{
public class ConcentratorSearchInfo
{
public string? SearchKeyword { get; set; }
public string? SearchStatus { get; set; }
public string? SearchState { get; set; }
public string? SearchText { get; set; }
public string? Status { get; set; }
public string? State { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
break;
}

var uri = $"api/lorawan/concentrators?pageNumber={state.Page}&pageSize={state.PageSize}&orderBy={orderBy}&keyword={this.concentratorSearchInfo.SearchKeyword}&status={this.concentratorSearchInfo.SearchStatus}&state={this.concentratorSearchInfo.SearchState}";
var uri = $"api/lorawan/concentrators?pageNumber={state.Page}&pageSize={state.PageSize}&orderBy={orderBy}&searchText={this.concentratorSearchInfo.SearchText}&status={this.concentratorSearchInfo.Status}&state={this.concentratorSearchInfo.State}";

var result = await LoRaWanConcentratorsClientService.GetConcentrators(uri);

Expand Down Expand Up @@ -176,7 +176,7 @@
this.concentratorSearchInfo = concentratorSearchInfo;
}

table.ReloadServerData();
await table.ReloadServerData();
}

private void Refresh()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public void SearchConcentrators_ClickOnSearch_SearchIsFired()
var receivedEvents = new List<ConcentratorSearchInfo>();
var expectedConcentratorSearchInfo = new ConcentratorSearchInfo
{
SearchKeyword = searchKeyword,
SearchState = string.Empty,
SearchStatus = string.Empty
SearchText = searchKeyword,
State = string.Empty,
Status = string.Empty
};

var cut = RenderComponent<ConcentratorSearch>(parameters => parameters.Add(p => p.OnSearch, (searchInfo) =>
Expand Down Expand Up @@ -60,9 +60,9 @@ public void SearchConcentrators_ClickOnReset_SearchKeyworkIsSetToEmptyAndSearchI
var receivedEvents = new List<ConcentratorSearchInfo>();
var expectedConcentratorSearchInfo = new ConcentratorSearchInfo
{
SearchKeyword = string.Empty,
SearchState = string.Empty,
SearchStatus = string.Empty
SearchText = string.Empty,
State = string.Empty,
Status = string.Empty
};

var cut = RenderComponent<ConcentratorSearch>(parameters => parameters.Add(p => p.OnSearch, (searchInfo) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override void Setup()
public void ConcentratorListPageShouldLoadAndShowConcentrators()
{
// Arrange
var expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&keyword=&status=&state=";
var expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&searchText=&status=&state=";

_ = this.mockLoRaWanConcentratorClientService.Setup(service =>
service.GetConcentrators(It.Is<string>(s => expectedUri.Equals(s, StringComparison.Ordinal))))
Expand Down Expand Up @@ -75,7 +75,7 @@ public void ConcentratorListPageShouldLoadAndShowConcentrators()
public void ConcentratorListPageShouldProcessProblemDetailsExceptionWhenIssueOccursOnLoadingConcentrators()
{
// Arrange
var expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&keyword=&status=&state=";
var expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&searchText=&status=&state=";

_ = this.mockLoRaWanConcentratorClientService.Setup(service =>
service.GetConcentrators(It.Is<string>(s => expectedUri.Equals(s, StringComparison.Ordinal))))
Expand All @@ -97,7 +97,7 @@ public void ClickToItemShouldRedirectToConcentratorDetailsPage()
{
// Arrange
var deviceId = Guid.NewGuid().ToString();
var expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&keyword=&status=&state=";
var expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&searchText=&status=&state=";

_ = this.mockLoRaWanConcentratorClientService.Setup(service =>
service.GetConcentrators(It.Is<string>(s => expectedUri.Equals(s, StringComparison.Ordinal))))
Expand Down Expand Up @@ -127,7 +127,7 @@ public void ClickToItemShouldRedirectToConcentratorDetailsPage()
public void ClickOnAddNewDeviceShouldNavigateToNewDevicePage()
{
// Arrange
const string expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&keyword=&status=&state=";
const string expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&searchText=&status=&state=";

_ = this.mockLoRaWanConcentratorClientService.Setup(service =>
service.GetConcentrators(It.Is<string>(s => expectedUri.Equals(s, StringComparison.Ordinal))))
Expand Down Expand Up @@ -156,7 +156,7 @@ public void ClickOnAddNewDeviceShouldNavigateToNewDevicePage()
public void ClickOnRefreshShouldReloadConcentrators()
{
// Arrange
var expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&keyword=&status=&state=";
var expectedUri = "api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&searchText=&status=&state=";

_ = this.mockLoRaWanConcentratorClientService.Setup(service =>
service.GetConcentrators(It.Is<string>(s => expectedUri.Equals(s, StringComparison.Ordinal))))
Expand All @@ -181,11 +181,11 @@ public void ClickOnSearchShouldSearchConcentrators()
var searchKeyword = Fixture.Create<string>();
var concentratorSearchInfo = new ConcentratorSearchInfo
{
SearchKeyword = searchKeyword,
SearchState = string.Empty,
SearchStatus = string.Empty
SearchText = searchKeyword,
State = string.Empty,
Status = string.Empty
};
var expectedUri = $"api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&keyword=&status=&state=";
var expectedUri = $"api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&searchText=&status=&state=";

_ = this.mockLoRaWanConcentratorClientService.Setup(service =>
service.GetConcentrators(It.Is<string>(s => expectedUri.Equals(s, StringComparison.Ordinal))))
Expand All @@ -199,7 +199,7 @@ public void ClickOnSearchShouldSearchConcentrators()
}
});

var expectedUriWithFilter = $"api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&keyword={concentratorSearchInfo.SearchKeyword}&status={concentratorSearchInfo.SearchStatus}&state={concentratorSearchInfo.SearchState}";
var expectedUriWithFilter = $"api/lorawan/concentrators?pageNumber=0&pageSize=10&orderBy=&searchText={concentratorSearchInfo.SearchText}&status={concentratorSearchInfo.Status}&state={concentratorSearchInfo.State}";

_ = this.mockLoRaWanConcentratorClientService.Setup(service =>
service.GetConcentrators(It.Is<string>(s => expectedUriWithFilter.Equals(s, StringComparison.Ordinal))))
Expand Down

0 comments on commit 4dbeb05

Please sign in to comment.