From 8387947180ec59d06089393ef5b17631233034ba Mon Sep 17 00:00:00 2001 From: Maria Date: Tue, 10 Dec 2024 11:15:12 +0000 Subject: [PATCH] formatting error in ContentController.ServerTests.cs fixed --- .../ContentController.ServerTests.cs | 46 ++++++++++++------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/Childrens-Social-Care-CPD-Tests/Controllers/ContentController.ServerTests.cs b/Childrens-Social-Care-CPD-Tests/Controllers/ContentController.ServerTests.cs index 326344bd..1d6758e0 100644 --- a/Childrens-Social-Care-CPD-Tests/Controllers/ContentController.ServerTests.cs +++ b/Childrens-Social-Care-CPD-Tests/Controllers/ContentController.ServerTests.cs @@ -1,4 +1,9 @@ -using Childrens_Social_Care_CPD.Contentful.Models; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Childrens_Social_Care_CPD.Contentful.Models; using Childrens_Social_Care_CPD_Tests.Contentful; using Contentful.Core.Models; using Contentful.Core.Search; @@ -6,11 +11,6 @@ using Microsoft.AspNetCore.Mvc.Testing; using NSubstitute; using NUnit.Framework; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; namespace Childrens_Social_Care_CPD_Tests.Controllers; @@ -24,10 +24,9 @@ public class ContentControllerServerTests public void SetUp() { _application = new CpdTestServerApplication(); - _httpClient = _application.CreateClient(new WebApplicationFactoryClientOptions - { - AllowAutoRedirect = false - }); + _httpClient = _application.CreateClient( + new WebApplicationFactoryClientOptions { AllowAutoRedirect = false } + ); } [Test] @@ -36,13 +35,21 @@ public async Task Content_Will_Contain_Warning_If_Data_Is_Self_Referential() // arrange var content = new Content(); content.Items = new List { content }; - var contentCollection = new ContentfulCollection() { Items = new List() { content } }; - _application.CpdContentfulClient.GetEntries(Arg.Any>(), Arg.Any()).Returns(contentCollection); + var contentCollection = new ContentfulCollection() + { + Items = new List() { content } + }; + _application + .CpdContentfulClient.GetEntries( + Arg.Any>(), + Arg.Any() + ) + .Returns(contentCollection); // act var response = await _httpClient.GetAsync(_contentUrl); var responseContent = await response.Content.ReadAsStringAsync(); - + // assert response.StatusCode.Should().Be(HttpStatusCode.OK); responseContent.Should().Contain("You have a circular link in your content"); @@ -52,12 +59,17 @@ public async Task Content_Will_Contain_Warning_If_Data_Is_Self_Referential() public async Task Content_Will_Contain_Warning_If_Data_Has_An_Unknown_Content_Type() { // arrange - var content = new Content + var content = new Content { Items = new List { new TestingContentItem() } }; + var contentCollection = new ContentfulCollection() { - Items = new List { new TestingContentItem() } + Items = new List() { content } }; - var contentCollection = new ContentfulCollection() { Items = new List() { content } }; - _application.CpdContentfulClient.GetEntries(Arg.Any>(), Arg.Any()).Returns(contentCollection); + _application + .CpdContentfulClient.GetEntries( + Arg.Any>(), + Arg.Any() + ) + .Returns(contentCollection); // act var response = await _httpClient.GetAsync(_contentUrl);