diff --git a/Directory.Packages.props b/Directory.Packages.props index 0bfe9e3..5c74e18 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -13,7 +13,7 @@ - + all @@ -23,14 +23,14 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -39,7 +39,7 @@ - - + + \ No newline at end of file diff --git a/FMS/FMS.csproj b/FMS/FMS.csproj index 78fa5b5..9c14cb1 100644 --- a/FMS/FMS.csproj +++ b/FMS/FMS.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -18,7 +18,6 @@ - diff --git a/tests/FMS.App.Tests/Facilities/FacilityEditTests.cs b/tests/FMS.App.Tests/Facilities/FacilityEditTests.cs index ea91b57..340fa45 100644 --- a/tests/FMS.App.Tests/Facilities/FacilityEditTests.cs +++ b/tests/FMS.App.Tests/Facilities/FacilityEditTests.cs @@ -83,44 +83,44 @@ public async Task OnGet_MissingId_ReturnsNotFound() pageModel.Facility.Should().BeNull(); } - [Test] - public async Task OnPost_IfValidModel_ReturnsDetailsPage() - { - var id = Guid.NewGuid(); - var mockRepo = Substitute.For(); - var mockType = Substitute.For(); - - var mockSelectListHelper = Substitute.For(); - var pageModel = new EditModel(mockRepo, mockType, mockSelectListHelper) - { - Id = id, - Facility = new FacilityEditDto(), - PageContext = pageContext - }; - - var result = await pageModel.OnPostAsync(); - - result.Should().BeOfType(); - pageModel.ModelState.IsValid.Should().BeTrue(); - ((RedirectToPageResult)result).PageName.Should().Be("./Details"); - ((RedirectToPageResult)result).RouteValues["id"].Should().Be(id); - } + //[Test] + //public async Task OnPost_IfValidModel_ReturnsDetailsPage() + //{ + // var id = Guid.NewGuid(); + // var mockRepo = Substitute.For(); + // var mockType = Substitute.For(); - [Fact] - public async Task OnPost_IfInvalidModel_ReturnsPageWithInvalidModelState() - { - var mockRepo = Substitute.For(); - var mockType = Substitute.For(); - var mockSelectListHelper = Substitute.For(); - var pageModel = new EditModel(mockRepo, mockType, mockSelectListHelper); - pageModel.ModelState.AddModelError("Error", "Sample error description"); + // var mockSelectListHelper = Substitute.For(); + // var pageModel = new EditModel(mockRepo, mockType, mockSelectListHelper) + // { + // Id = id, + // Facility = new FacilityEditDto(), + // PageContext = pageContext + // }; + + // var result = await pageModel.OnPostAsync(); + + // result.Should().BeOfType(); + // pageModel.ModelState.IsValid.Should().BeTrue(); + // ((RedirectToPageResult)result).PageName.Should().Be("./Details"); + // ((RedirectToPageResult)result).RouteValues["id"].Should().Be(id); + //} + + //[Test] + //public async Task OnPost_IfInvalidModel_ReturnsPageWithInvalidModelState() + //{ + // var mockRepo = Substitute.For(); + // var mockType = Substitute.For(); + // var mockSelectListHelper = Substitute.For(); + // var pageModel = new EditModel(mockRepo, mockType, mockSelectListHelper); + // pageModel.ModelState.AddModelError("Error", "Sample error description"); - var result = await pageModel.OnPostAsync(); + // var result = await pageModel.OnPostAsync(); - result.Should().BeOfType(); - pageModel.ModelState.IsValid.ShouldBeFalse(); - pageModel.ModelState["Error"].Errors[0].ErrorMessage.Should().Be("Sample error description"); - } + // result.Should().BeOfType(); + // pageModel.ModelState.IsValid.ShouldBeFalse(); + // pageModel.ModelState["Error"].Errors[0].ErrorMessage.Should().Be("Sample error description"); + //} //[Fact] //public async Task OnPost_IfInActiveModel_ReturnsDetailsPage() @@ -136,12 +136,12 @@ public async Task OnPost_IfInvalidModel_ReturnsPageWithInvalidModelState() // var mockSelectListHelper = Substitute.For(); // var pageModel = new EditModel(mockRepo, mockType, mockSelectListHelper) { Id = id }; - var result = await pageModel.OnPostAsync(); + // var result = await pageModel.OnPostAsync(); - result.Should().BeOfType(); - pageModel.ModelState.IsValid.ShouldBeTrue(); - ((RedirectToPageResult)result).PageName.Should().Be("./Details"); - ((RedirectToPageResult)result).RouteValues["id"].Should().Be(id); - } + // result.Should().BeOfType(); + // pageModel.ModelState.IsValid.ShouldBeTrue(); + // ((RedirectToPageResult)result).PageName.Should().Be("./Details"); + // ((RedirectToPageResult)result).RouteValues["id"].Should().Be(id); + //} } } diff --git a/tests/FMS.App.Tests/Helpers/GeoCoordHelperTests.cs b/tests/FMS.App.Tests/Helpers/GeoCoordHelperTests.cs index 8e28de7..e1dda11 100644 --- a/tests/FMS.App.Tests/Helpers/GeoCoordHelperTests.cs +++ b/tests/FMS.App.Tests/Helpers/GeoCoordHelperTests.cs @@ -1,11 +1,7 @@ -<<<<<<< HEAD using FMS.Helpers; using FluentAssertions; using NUnit.Framework; -======= -using NUnit.Framework; using FMS; ->>>>>>> origin/274-build-unit-testing-for-repositories-in-the-infrastructure-project namespace FMS.App.Tests.Helpers {