-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from DFE-Digital/rationale-for-project
Rationale for project
- Loading branch information
Showing
31 changed files
with
749 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Net; | ||
|
||
namespace ApplyToBecome.Data | ||
{ | ||
public class ApiResponse<TBody> | ||
{ | ||
public ApiResponse(HttpStatusCode statusCode, TBody body) | ||
{ | ||
Success = (int)statusCode >= 200 && (int)statusCode < 300; | ||
Body = body; | ||
} | ||
|
||
public bool Success { get; } | ||
public TBody Body { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
ApplyToBecomeInternal/ApplyToBecome.Data/Models/UpdateProject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace ApplyToBecome.Data.Models | ||
{ | ||
public class UpdateProject | ||
{ | ||
public string RationaleForProject { get; set; } | ||
public string RationaleForTrust { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...oBecomeInternal/ApplyToBecomeInternal.Tests/Customisations/OfstedRatingSpecimenBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using AutoFixture.Kernel; | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace ApplyToBecomeInternal.Tests.Customisations | ||
{ | ||
public class OfstedRatingSpecimenBuilder : ISpecimenBuilder | ||
{ | ||
public object Create(object request, ISpecimenContext context) | ||
{ | ||
var pi = request as PropertyInfo; | ||
if (pi == null || pi.PropertyType != typeof(string)) | ||
return new NoSpecimen(); | ||
|
||
var i = new Random().Next(); | ||
|
||
return "12349".Substring(i % 5, 1); | ||
} | ||
} | ||
} |
51 changes: 0 additions & 51 deletions
51
ApplyToBecomeInternal/ApplyToBecomeInternal.Tests/Extensions/AngleSharpExtensions.cs
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
ApplyToBecomeInternal/ApplyToBecomeInternal.Tests/Extensions/FluentAssertionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using FluentAssertions.Primitives; | ||
|
||
namespace FluentAssertions | ||
{ | ||
public static class FluentAssertionExtensions | ||
{ | ||
public static void BeUrl(this StringAssertions stringAssertions, string url) | ||
{ | ||
stringAssertions.Be($"http://localhost{url}"); | ||
} | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
ApplyToBecomeInternal/ApplyToBecomeInternal.Tests/Helpers/HtmlHelper.cs
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
ApplyToBecomeInternal/ApplyToBecomeInternal.Tests/Helpers/PortHelper.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
ApplyToBecomeInternal/ApplyToBecomeInternal.Tests/Pages/BaseIntegrationTests.MockData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using ApplyToBecome.Data.Models; | ||
using ApplyToBecomeInternal.Tests.Customisations; | ||
using AutoFixture; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
using SchoolPerformanceModel = ApplyToBecome.Data.Models.SchoolPerformance; | ||
|
||
namespace ApplyToBecomeInternal.Tests.Pages | ||
{ | ||
public abstract partial class BaseIntegrationTests | ||
{ | ||
protected IEnumerable<Project> AddGetProjects() | ||
{ | ||
var projects = _fixture.CreateMany<Project>(); | ||
_factory.AddGetWithJsonResponse("/conversion-projects", projects); | ||
return projects; | ||
} | ||
|
||
public Project AddGetProject(Action<Project> postSetup = null) | ||
{ | ||
var project = _fixture.Create<Project>(); | ||
if (postSetup != null) | ||
{ | ||
postSetup(project); | ||
} | ||
_factory.AddGetWithJsonResponse($"/conversion-projects/{project.Id}", project); | ||
return project; | ||
} | ||
|
||
public (Project, UpdateProject) AddGetAndPatchProject<TProperty>(Expression<Func<UpdateProject, TProperty>> expression) | ||
{ | ||
var project = _fixture.Create<Project>(); | ||
var request = _fixture | ||
.Build<UpdateProject>() | ||
.OmitAutoProperties() | ||
.With(expression) | ||
.Create(); | ||
|
||
_factory.AddGetWithJsonResponse($"/conversion-projects/{project.Id}", project); | ||
_factory.AddPatchWithJsonRequest($"/conversion-projects/{project.Id}", request, project); | ||
return (project, request); | ||
} | ||
|
||
public void AddPatchError(int id) | ||
{ | ||
_factory.AddErrorResponse($"/conversion-projects/{id}", "patch"); | ||
} | ||
|
||
public SchoolPerformanceModel AddGetSchoolPerformance(string urn) | ||
{ | ||
_fixture.Customizations.Add(new OfstedRatingSpecimenBuilder()); | ||
var establishmentMockData = _fixture.Create<EstablishmentMockData>(); | ||
_factory.AddGetWithJsonResponse($"/establishment/urn/{urn}", establishmentMockData); | ||
return establishmentMockData.misEstablishment; | ||
} | ||
|
||
private class EstablishmentMockData | ||
{ | ||
public SchoolPerformanceModel misEstablishment { get; set; } | ||
|
||
public DateTime ofstedLastInspection { get; set; } | ||
} | ||
} | ||
} |
Oops, something went wrong.