Skip to content

Commit

Permalink
chore nuget deps update and lint (#519)
Browse files Browse the repository at this point in the history
* chore nuget deps update and lint

* update dotnet tools json
  • Loading branch information
glgoaco authored Aug 28, 2024
1 parent ea9eea2 commit 2199f94
Show file tree
Hide file tree
Showing 128 changed files with 230 additions and 219 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.7",
"version": "8.0.8",
"commands": [
"dotnet-ef"
],
"rollForward": false
},
"microsoft.dotnet-openapi": {
"version": "8.0.6",
"version": "8.0.8",
"commands": [
"dotnet-openapi"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,4 @@ public async Task OnGetAsync_ShouldHandleEmptySharedConsentDetailsList()
_pageModel.SharedConsentDetailsList.Should().NotBeNull();
_pageModel.SharedConsentDetailsList.Should().BeEmpty();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void OnPost_ShouldSetBackPageLink_ToExpectedPage(
.Returns(state);

var result = _model.OnPost();

var pageResult = result.Should().BeOfType<RedirectToPageResult>();

pageResult.Which.PageName.Should().Be(expectedRedirectPage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void OnPost_ShouldUpdateSessionState_WhenModelStateIsValid()
[InlineData(false, true, ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.DirectorOrTheSameResponsibilities, "legal-form-question")]
[InlineData(true, true, ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.ParentOrSubsidiaryCompany, "postal-address-same-as-registered")]
[InlineData(true, true, ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl, "postal-address-same-as-registered")]
[InlineData(true, true, ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.ParentOrSubsidiaryCompany, "Postal-address/uk",false, false)]
[InlineData(true, true, ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.ParentOrSubsidiaryCompany, "Postal-address/uk", false, false)]
[InlineData(true, true, ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl, "Postal-address/uk", false, false)]
[InlineData(true, true, ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.ACompanyYourOrganisationHasTakenOver, "Registered-address/uk")]
public void OnGet_BackPageNameShouldBeExpectedPage(
Expand Down Expand Up @@ -168,7 +168,7 @@ public void OnPost_ShouldRedirectToExpectedPage(
ConnectedEntityOrganisationCategoryType organisationCategoryType,
string expectedRedirectPage)
{

var state = DummyConnectedPersonDetails();
state.SupplierHasCompanyHouseNumber = yesJourney;
state.HasCompaniesHouseNumber = hasCompanyHouseNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public void OnPost_ShouldReturnPage_WhenModelStateIsInvalid()
}

[Theory]
[InlineData(Constants.ConnectedEntityType.Organisation, Constants.ConnectedEntityOrganisationCategoryType.RegisteredCompany, false,"ConnectedEntityCheckAnswersOrganisation", "date-registered-question")]
[InlineData(Constants.ConnectedEntityType.Organisation, Constants.ConnectedEntityOrganisationCategoryType.RegisteredCompany, true,"ConnectedEntityCheckAnswersOrganisation", "date-registered")]
[InlineData(Constants.ConnectedEntityType.Organisation, Constants.ConnectedEntityOrganisationCategoryType.RegisteredCompany, false, "ConnectedEntityCheckAnswersOrganisation", "date-registered-question")]
[InlineData(Constants.ConnectedEntityType.Organisation, Constants.ConnectedEntityOrganisationCategoryType.RegisteredCompany, true, "ConnectedEntityCheckAnswersOrganisation", "date-registered")]
[InlineData(Constants.ConnectedEntityType.Organisation, Constants.ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl, false, "ConnectedEntityLegalFormQuestion", "date-registered-question")]
public void OnPost_ShouldRedirectToConnectedEntityCategoryPageOrganisation(
Constants.ConnectedEntityType connectedEntityType,
Expand Down Expand Up @@ -140,10 +140,10 @@ string expectedBackPageLink
}

[Theory]
[InlineData(Constants.ConnectedEntityType.Individual, Constants.ConnectedEntityIndividualAndTrustCategoryType.PersonWithSignificantControlForIndividual, false,"ConnectedEntityCheckAnswersIndividualOrTrust", "date-registered-question")]
[InlineData(Constants.ConnectedEntityType.TrustOrTrustee, Constants.ConnectedEntityIndividualAndTrustCategoryType.PersonWithSignificantControlForTrust, false,"ConnectedEntityCheckAnswersIndividualOrTrust", "date-registered-question")]
[InlineData(Constants.ConnectedEntityType.Individual, Constants.ConnectedEntityIndividualAndTrustCategoryType.PersonWithSignificantControlForIndividual, true,"ConnectedEntityCheckAnswersIndividualOrTrust", "date-registered")]
[InlineData(Constants.ConnectedEntityType.TrustOrTrustee, Constants.ConnectedEntityIndividualAndTrustCategoryType.PersonWithSignificantControlForTrust, true,"ConnectedEntityCheckAnswersIndividualOrTrust", "date-registered")]
[InlineData(Constants.ConnectedEntityType.Individual, Constants.ConnectedEntityIndividualAndTrustCategoryType.PersonWithSignificantControlForIndividual, false, "ConnectedEntityCheckAnswersIndividualOrTrust", "date-registered-question")]
[InlineData(Constants.ConnectedEntityType.TrustOrTrustee, Constants.ConnectedEntityIndividualAndTrustCategoryType.PersonWithSignificantControlForTrust, false, "ConnectedEntityCheckAnswersIndividualOrTrust", "date-registered-question")]
[InlineData(Constants.ConnectedEntityType.Individual, Constants.ConnectedEntityIndividualAndTrustCategoryType.PersonWithSignificantControlForIndividual, true, "ConnectedEntityCheckAnswersIndividualOrTrust", "date-registered")]
[InlineData(Constants.ConnectedEntityType.TrustOrTrustee, Constants.ConnectedEntityIndividualAndTrustCategoryType.PersonWithSignificantControlForTrust, true, "ConnectedEntityCheckAnswersIndividualOrTrust", "date-registered")]
public void OnPost_ShouldRedirectToConnectedEntityCategoryPageIndividualTrust(
Constants.ConnectedEntityType connectedEntityType,
Constants.ConnectedEntityIndividualAndTrustCategoryType individualOTrustCategoryType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void OnGet_ShouldReturnPageResult()
_model.ControlConditions.Should().Contain(Constants.ConnectedEntityControlCondition.OwnsShares);
}

[Theory]
[Theory]
[InlineData(true, ConnectedEntityType.Organisation, "overseas-company-question", ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl, null, null)]
[InlineData(true, ConnectedEntityType.Organisation, "company-question", ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl, null, true)]
[InlineData(true, ConnectedEntityType.Organisation, "company-question", ConnectedEntityOrganisationCategoryType.RegisteredCompany, null, null)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void OnPost_ShouldRedirectToExpectedPage(

_sessionMock.Setup(s => s.Get<ConnectedEntityState>(Session.ConnectedPersonKey)).
Returns(state);


var result = _model.OnPost();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void OnPost_BackPageNameShouldBeExpectedPage(
state.SupplierHasCompanyHouseNumber = yesJourney;
state.ConnectedEntityType = connectedEntityType;
state.ConnectedEntityOrganisationCategoryType = organisationCategoryType;

_sessionMock.Setup(s => s.Get<ConnectedEntityState>(Session.ConnectedPersonKey)).
Returns(state);

Expand All @@ -157,7 +157,7 @@ private ConnectedEntityState DummyConnectedPersonDetails()
HasCompaniesHouseNumber = false,
HasOverseasCompaniesHouseNumber = true,
OverseasCompaniesHouseNumber = "12345678",
ConnectedEntityOrganisationCategoryType= ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl
ConnectedEntityOrganisationCategoryType = ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl
};

return connectedPersonDetails;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ public void OnPost_ShouldRedirectToExpectedPage_WhenModelStateIsValid(string exp

var redirectToPageResult = result.Should().BeOfType<RedirectToPageResult>().Subject;

redirectToPageResult.PageName.Should().Be(expectedRedirectPage);
redirectToPageResult.PageName.Should().Be(expectedRedirectPage);
}

[Theory]
[InlineData(ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.RegisteredCompany, null, true, "ConnectedEntityCompanyRegisterName", false, "nature-of-control")]
[InlineData(ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.RegisteredCompany, null, false, "ConnectedEntityCheckAnswersOrganisation", false, "nature-of-control")]
[InlineData(ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.RegisteredCompany, null, true, "ConnectedEntityCompanyRegisterName", false, "nature-of-control")]
[InlineData(ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.RegisteredCompany, null, false, "ConnectedEntityCheckAnswersOrganisation", false, "nature-of-control")]
[InlineData(ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl, null, true, "ConnectedEntityCompanyRegisterName", false, "company-question", true)]
[InlineData(ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl, null, false, "ConnectedEntityLegalFormQuestion", false, "nature-of-control", false)]
[InlineData(ConnectedEntityType.Organisation, ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl, null, false, "ConnectedEntityLegalFormQuestion", false, "company-question", true)]
Expand Down Expand Up @@ -165,7 +165,7 @@ public void OnPost_ShouldRedirectToExpectedPage_AndSetBackPageLink_WhenModelStat
state.ConnectedEntityIndividualAndTrustCategoryType = individualAndTrustCategoryType;
state.HasRegistartionDate = hasRegistrationDate;
state.RegistrationDate = hasRegistrationDate == true ? DateTime.UtcNow : null;


_sessionMock.Setup(s => s.Get<ConnectedEntityState>(Session.ConnectedPersonKey)).
Returns(state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ public void InitModel_ShouldSetModelPropertiesFromState_WhenStateHasData()
Assert.True(_addUserModel.IsAdmin);
Assert.Equal(AddUserModel.ScopeEditor, _addUserModel.Role);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public UserRemoveConfirmationModelTests()
[Fact]
public async Task OnGet_Returns_Page_When_Person_Found()
{
var person = new Organisation.WebApiClient.Person ("[email protected]", "John", _pageModel.UserId, "Johnson", []);
var person = new Organisation.WebApiClient.Person("[email protected]", "John", _pageModel.UserId, "Johnson", []);
_mockOrganisationClient.Setup(client => client.GetOrganisationPersonsAsync(It.IsAny<Guid>()))
.ReturnsAsync(new List<Organisation.WebApiClient.Person> { person });

Expand Down Expand Up @@ -92,7 +92,7 @@ public async Task OnPost_Returns_Page_When_ModelState_Is_Invalid()
public async Task OnPost_Redirects_To_UserSummary_When_ConfirmRemove_Is_True_And_Person_Exists()
{
_pageModel.ConfirmRemove = true;
var person = new Organisation.WebApiClient.Person ("[email protected]", "John", _pageModel.UserId, "Johnson", []);
var person = new Organisation.WebApiClient.Person("[email protected]", "John", _pageModel.UserId, "Johnson", []);
_mockOrganisationClient.Setup(client => client.GetOrganisationPersonsAsync(It.IsAny<Guid>()))
.ReturnsAsync(new List<Organisation.WebApiClient.Person> { person });

Expand Down Expand Up @@ -134,7 +134,7 @@ public async Task OnPost_Redirects_To_UserSummary_When_ConfirmRemove_Is_False()
[Fact]
public async Task GetPerson_Returns_Person_When_Found()
{
var person = new Organisation.WebApiClient.Person ("[email protected]", "John", _pageModel.UserId, "Johnson", []);
var person = new Organisation.WebApiClient.Person("[email protected]", "John", _pageModel.UserId, "Johnson", []);
_mockOrganisationClient.Setup(client => client.GetOrganisationPersonsAsync(It.IsAny<Guid>()))
.ReturnsAsync(new List<Organisation.WebApiClient.Person> { person });

Expand All @@ -146,7 +146,7 @@ public async Task GetPerson_Returns_Person_When_Found()
[Fact]
public async Task GetPersonInvite_Returns_PersonInvite_When_Found()
{
var personInvite = new PersonInviteModel ("[email protected]", "John", _pageModel.UserId, "Johnson", []);
var personInvite = new PersonInviteModel("[email protected]", "John", _pageModel.UserId, "Johnson", []);
_mockOrganisationClient.Setup(client => client.GetOrganisationPersonInvitesAsync(It.IsAny<Guid>()))
.ReturnsAsync(new List<PersonInviteModel> { personInvite });

Expand Down Expand Up @@ -176,4 +176,4 @@ public async Task GetPerson_Returns_Null_When_ApiException_Is_Thrown_With_404()

Assert.Null(result);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public async Task OnGet_ReturnsPageResult_WhenApiCallsSucceed()
var organisationId = Guid.NewGuid();
_pageModel.Id = organisationId;

var person = new Organisation.WebApiClient.Person("[email protected]", "John", _userGuid, "Johnson", ["ADMIN"] );
var person = new Organisation.WebApiClient.Person("[email protected]", "John", _userGuid, "Johnson", ["ADMIN"]);

_mockOrganisationClient
.Setup(client => client.GetOrganisationPersonsAsync(organisationId))
Expand All @@ -63,7 +63,7 @@ public async Task OnGet_RedirectsToPageNotFound_WhenUserDoesNotHaveAdminRole()
var organisationId = Guid.NewGuid();
_pageModel.Id = organisationId;

var person = new Organisation.WebApiClient.Person("[email protected]", "Johnny", _userGuid, "NoAdminJohnson", ["VIEWER"] );
var person = new Organisation.WebApiClient.Person("[email protected]", "Johnny", _userGuid, "NoAdminJohnson", ["VIEWER"]);

_mockOrganisationClient
.Setup(client => client.GetOrganisationPersonsAsync(organisationId))
Expand Down Expand Up @@ -132,4 +132,4 @@ public void OnPost_RedirectsToOrganisationPage_WhenHasPersonIsFalse()
var redirectResult = Assert.IsType<RedirectResult>(result);
Assert.Equal($"/organisation/{organisationId}", redirectResult.Url);
}
}
}
4 changes: 2 additions & 2 deletions Frontend/CO.CDP.OrganisationApp/CO.CDP.OrganisationApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.8" />
<PackageReference Include="IdentityModel" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.8" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion Frontend/CO.CDP.OrganisationApp/Models/DynamicForms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class FormSection
public bool AllowsMultipleAnswerSets { get; set; }
}

public enum FormSectionType {
public enum FormSectionType
{
Standard,
Declaration
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ public class SharedConsentDetails
{
public DateTimeOffset SubmittedAt { get; set; }
public string? ShareCode { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public async Task<IActionResult> OnPost()
{
await LookupOrganisationAsync();
}
catch (Exception orgApiException) when(orgApiException is Organisation.WebApiClient.ApiException && ((Organisation.WebApiClient.ApiException)orgApiException).StatusCode == 404)
catch (Exception orgApiException) when (orgApiException is Organisation.WebApiClient.ApiException && ((Organisation.WebApiClient.ApiException)orgApiException).StatusCode == 404)
{
try
{
Expand All @@ -214,7 +214,7 @@ public async Task<IActionResult> OnPost()
return RedirectToPage("OrganisationRegistrationUnavailable");
}
}

return RedirectToPage("OrganisationAlreadyRegistered");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public abstract class RegistrationStepModel : LoggedInUserAwareModel
public const string OrganisationAddressPage = "/registration/organisation-registered-address/uk";
public const string OrganisationNonUKAddressPage = "/registration/organisation-registered-address/non-uk";
public const string OrganisationSummaryPage = "/registration/organisation-details-summary";

public const string BuyerOrganisationTypePage = "/registration/buyer-organisation-type";
public const string BuyerDevolvedRegulationPage = "/registration/buyer-devolved-regulations";
public const string BuyerSelectDevolvedRegulationPage = "/registration/buyer-select-devolved-regulations";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ public async Task<IActionResult> OnGet(string shareCode)
}
return Page();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ public async Task<IActionResult> OnGet()
}
return Page();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private string GetRedirectLinkPageName(ConnectedEntityState state)
redirectPage = "ConnectedEntityCompanyQuestion";
break;

case ConnectedEntityOrganisationCategoryType.ParentOrSubsidiaryCompany:
case ConnectedEntityOrganisationCategoryType.ParentOrSubsidiaryCompany:
case ConnectedEntityOrganisationCategoryType.AnyOtherOrganisationWithSignificantInfluenceOrControl:
redirectPage = (AddressType == AddressType.Postal && state.PostalAddress != null)
? "ConnectedEntityCompanyQuestion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private string GetBackLinkPageName(ConnectedEntityState state)
case ConnectedEntityIndividualAndTrustCategoryType.AnyOtherIndividualWithSignificantInfluenceOrControlForTrust:
backPage = state.SupplierHasCompanyHouseNumber == true
? "date-registered"
: "date-registered-question";
: "date-registered-question";
break;
case ConnectedEntityIndividualAndTrustCategoryType.DirectorOrIndividualWithTheSameResponsibilitiesForTrust:
backPage = $"{Constants.AddressType.Registered}-address/{(string.Equals(state.RegisteredAddress?.Country, Country.UKCountryCode, StringComparison.OrdinalIgnoreCase) ? "uk" : "non-uk")}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,5 @@ private string GetRedirectLinkPageName(ConnectedEntityState state)

return redirectPage;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public async Task<IActionResult> OnPost()
ModelState.AddModelError(nameof(EndDate), "Date of removal must be a real date");
return Page();
}
endDate = endDate.AddHours(23).AddMinutes(59).AddSeconds(59).ToUniversalTime();
endDate = endDate.AddHours(23).AddMinutes(59).AddSeconds(59).ToUniversalTime();
await organisationClient.DeleteConnectedEntityAsync(Id, ConnectedPersonId, new DeleteConnectedEntity(endDate));
}

Expand Down
2 changes: 1 addition & 1 deletion Frontend/CO.CDP.OrganisationApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@
return Task.CompletedTask;
});

app.Run();
app.Run();
Loading

0 comments on commit 2199f94

Please sign in to comment.