From b9f8a5d318f45bf5b94fceda0f72e501bbe76da5 Mon Sep 17 00:00:00 2001 From: simonjfirth Date: Mon, 19 Aug 2024 14:18:12 +0100 Subject: [PATCH] Fixed unit tests --- .../Mapped/Custom/CustomAccordionTests.cs | 9 +++++---- .../Mapped/Custom/CustomAttachmentTests.cs | 7 ++++--- .../Models/Mapped/Custom/CustomCardTests.cs | 14 +++++++------- .../Mapped/Custom/CustomGridContainerTests.cs | 18 ++++++++++-------- .../Mapped/Standard/EmbeddedEntryTests.cs | 5 +++-- .../Services/ContentServiceTests.cs | 6 +++--- .../Services/ModelMapperTests.cs | 18 ++++++++++-------- 7 files changed, 42 insertions(+), 35 deletions(-) diff --git a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAccordionTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAccordionTests.cs index dd1b845..1beccdc 100644 --- a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAccordionTests.cs +++ b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAccordionTests.cs @@ -1,4 +1,5 @@ -using Dfe.ContentSupport.Web.Common; +using Contentful.Core.Models; +using Dfe.ContentSupport.Web.Common; using Dfe.ContentSupport.Web.Configuration; using Dfe.ContentSupport.Web.Models; using Dfe.ContentSupport.Web.Models.Mapped; @@ -28,11 +29,11 @@ public class CustomAccordionTests InternalName = InternalName, Title = Title, SummaryLine = SummaryLine, - Sys = new Sys + SystemProperties = new SystemProperties { - ContentType = new ContentType + ContentType = new Contentful.Core.Models.ContentType { - Sys = new Sys + SystemProperties = new SystemProperties { Id = ContentId } diff --git a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAttachmentTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAttachmentTests.cs index 7b2ffdf..da395a0 100644 --- a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAttachmentTests.cs +++ b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAttachmentTests.cs @@ -31,11 +31,12 @@ public class CustomAttachmentTests { InternalName = InternalName, Title = Title, - Sys = new Sys + SystemProperties = new SystemProperties { - ContentType = new ContentType + ContentType = new Contentful.Core.Models.ContentType { - Sys = new Sys + + SystemProperties = new SystemProperties { Id = ContentId } diff --git a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomCardTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomCardTests.cs index c90df3a..bc88b30 100644 --- a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomCardTests.cs +++ b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomCardTests.cs @@ -34,13 +34,13 @@ public class CustomCardTests Meta = Meta, ImageAlt = ImageAlt, Description = Description, - Sys = new Sys + SystemProperties = new Contentful.Core.Models.SystemProperties { - ContentType = new ContentType + ContentType = new Contentful.Core.Models.ContentType { - Sys = new Sys + SystemProperties = new Contentful.Core.Models.SystemProperties { - Id = ContentId + Id = "csCard" } } }, @@ -52,10 +52,10 @@ public class CustomCardTests { Url = ImageUri } - } + }, } - } - } + }, + }, }; [Fact] diff --git a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomGridContainerTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomGridContainerTests.cs index 0bab7f3..cd74279 100644 --- a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomGridContainerTests.cs +++ b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomGridContainerTests.cs @@ -1,4 +1,5 @@ -using Dfe.ContentSupport.Web.Common; +using Contentful.Core.Models; +using Dfe.ContentSupport.Web.Common; using Dfe.ContentSupport.Web.Configuration; using Dfe.ContentSupport.Web.Models; using Dfe.ContentSupport.Web.Models.Mapped.Custom; @@ -31,11 +32,12 @@ public class CustomGridContainerTests Meta = CardMeta, ImageAlt = CardImageAlt, Description = CardDescription, - Sys = new Sys + SystemProperties = new SystemProperties { - ContentType = new ContentType + ContentType = new Contentful.Core.Models.ContentType { - Sys = new Sys + + SystemProperties = new SystemProperties { Id = CardContentId } @@ -45,7 +47,7 @@ public class CustomGridContainerTests { Fields = new Fields { - File = new FileDetails + File = new Web.Models.FileDetails { Url = CardImageUri } @@ -61,11 +63,11 @@ public class CustomGridContainerTests Target = new Target { InternalName = ContainerInternalName, - Sys = new Sys + SystemProperties = new Contentful.Core.Models.SystemProperties { - ContentType = new ContentType + ContentType = new Contentful.Core.Models.ContentType { - Sys = new Sys + SystemProperties = new Contentful.Core.Models.SystemProperties { Id = ContainerContentId } diff --git a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Standard/EmbeddedEntryTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Standard/EmbeddedEntryTests.cs index 23f8ca5..c285b58 100644 --- a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Standard/EmbeddedEntryTests.cs +++ b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Standard/EmbeddedEntryTests.cs @@ -1,4 +1,5 @@ -using Dfe.ContentSupport.Web.Common; +using Contentful.Core.Models; +using Dfe.ContentSupport.Web.Common; using Dfe.ContentSupport.Web.Configuration; using Dfe.ContentSupport.Web.Models; using Dfe.ContentSupport.Web.Models.Mapped.Standard; @@ -22,7 +23,7 @@ public class EmbeddedEntryTests { InternalName = InternalName, JumpIdentifier = JumpIdentifier, - Sys = new Sys() + SystemProperties = new SystemProperties() } } }; diff --git a/tests/Dfe.ContentSupport.Web.Tests/Services/ContentServiceTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Services/ContentServiceTests.cs index 704f487..135cfba 100644 --- a/tests/Dfe.ContentSupport.Web.Tests/Services/ContentServiceTests.cs +++ b/tests/Dfe.ContentSupport.Web.Tests/Services/ContentServiceTests.cs @@ -19,9 +19,9 @@ public class ContentServiceTests { Items = new List { - new() { Slug = "slug1", IsSitemap = true, Sys = new Sys() }, - new() { Slug = "slug2", IsSitemap = false, Sys = new Sys() }, - new() { Slug = "slug3", IsSitemap = true, Sys = new Sys() } + new() { Slug = "slug1", IsSitemap = true, SystemProperties = new SystemProperties() }, + new() { Slug = "slug2", IsSitemap = false, SystemProperties = new SystemProperties() }, + new() { Slug = "slug3", IsSitemap = true, SystemProperties = new SystemProperties() } } }; diff --git a/tests/Dfe.ContentSupport.Web.Tests/Services/ModelMapperTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Services/ModelMapperTests.cs index 9f6b38b..e5dffba 100644 --- a/tests/Dfe.ContentSupport.Web.Tests/Services/ModelMapperTests.cs +++ b/tests/Dfe.ContentSupport.Web.Tests/Services/ModelMapperTests.cs @@ -1,4 +1,5 @@ -using Dfe.ContentSupport.Web.Common; +using Contentful.Core.Models; +using Dfe.ContentSupport.Web.Common; using Dfe.ContentSupport.Web.Configuration; using Dfe.ContentSupport.Web.Models; using Dfe.ContentSupport.Web.Models.Mapped; @@ -22,15 +23,15 @@ public void MapToCsPages_Return_Correct_Amount() { new() { - Sys = new Sys() + SystemProperties = new SystemProperties() }, new() { - Sys = new Sys() + SystemProperties = new SystemProperties() }, new() - { - Sys = new Sys() + { + SystemProperties = new SystemProperties() } }; @@ -132,11 +133,12 @@ public void UnknownCustom_Returns_Null() { var testValue = new Target { - Sys = new Sys + SystemProperties = new SystemProperties { - ContentType = new ContentType + ContentType = new Contentful.Core.Models.ContentType { - Sys = new Sys + + SystemProperties = new SystemProperties { Id = "DUMMY" }