From d39d5271c5eddfb75cfd9ecd63c0b06a90959ae8 Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 2 Jan 2020 15:03:16 +0000 Subject: [PATCH 1/7] MAS-129 Daily email all fields no branding --- .../ContentControllerTests.cs | 2 +- lambda/MAS/Controllers/MailController.cs | 2 +- lambda/MAS/Models/DailyEmail.cs | 48 +++++++++++++++++++ lambda/MAS/Models/Item.cs | 4 +- lambda/MAS/Services/MailService.cs | 20 ++------ lambda/MAS/Services/S3Service.cs | 2 +- 6 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 lambda/MAS/Models/DailyEmail.cs diff --git a/lambda/MAS.Tests/IntergrationTests/ContentControllerTests.cs b/lambda/MAS.Tests/IntergrationTests/ContentControllerTests.cs index 9a9bd3d2..102363b9 100644 --- a/lambda/MAS.Tests/IntergrationTests/ContentControllerTests.cs +++ b/lambda/MAS.Tests/IntergrationTests/ContentControllerTests.cs @@ -43,7 +43,7 @@ public async Task PutCMSItemSavesItemIntoS3() Key = "mas_evidence_types:Safety%20alerts", Title = "Safety alerts" }, - UKMiComment = "UKMI Comment", + Comment = "SPS Comment", ResourceLinks = "

Link 1

\r\n

Link 2

" }; diff --git a/lambda/MAS/Controllers/MailController.cs b/lambda/MAS/Controllers/MailController.cs index d9ea13a4..5521597e 100644 --- a/lambda/MAS/Controllers/MailController.cs +++ b/lambda/MAS/Controllers/MailController.cs @@ -25,7 +25,7 @@ public async Task PutMailAsync() { var items = await _contentService.GetItemsAsync(); - var body = _mailService.CreateEmailBody(items); + var body = _mailService.CreateDailyEmailBody(items); var subject = "MAS Email"; var previewText = "This MAS email was created " + DateTime.Now.ToShortDateString(); diff --git a/lambda/MAS/Models/DailyEmail.cs b/lambda/MAS/Models/DailyEmail.cs new file mode 100644 index 00000000..56513417 --- /dev/null +++ b/lambda/MAS/Models/DailyEmail.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MAS.Models +{ + public class DailyEmail + { + public List Items { get; set; } + public List> GroupedItems + { + get + { + return Items.GroupBy(x => x.EvidenceType).ToList(); + } + } + + public string HTML + { + get + { + var body = new StringBuilder(); + + foreach (var group in GroupedItems) + { + var speciality = group.Single().EvidenceType.Title; + body.Append("" + speciality + ""); + + foreach(var item in group) + { + body.Append("
"); + body.Append(item.Source.Title); + body.Append("
"); + body.Append(item.Title); + body.Append("
"); + body.Append(item.ShortSummary); + body.Append("
"); + body.Append("SPS Comment"); + } + } + + return body.ToString(); + } + } + } +} diff --git a/lambda/MAS/Models/Item.cs b/lambda/MAS/Models/Item.cs index a0d21231..a3ac21fe 100644 --- a/lambda/MAS/Models/Item.cs +++ b/lambda/MAS/Models/Item.cs @@ -7,6 +7,8 @@ public class Item { [JsonProperty("_id"), Required, JsonRequired] public string Id { get; set; } + [JsonProperty("slug")] + public string Slug { get; set; } [Required, JsonRequired] public string Title { get; set; } [Required, JsonRequired] @@ -14,7 +16,7 @@ public class Item [Required, JsonRequired] public EvidenceType EvidenceType { get; set; } public string ShortSummary { get; set; } - public string UKMiComment { get; set; } + public string Comment { get; set; } public string ResourceLinks { get; set; } } } diff --git a/lambda/MAS/Services/MailService.cs b/lambda/MAS/Services/MailService.cs index e495acf0..680c2332 100644 --- a/lambda/MAS/Services/MailService.cs +++ b/lambda/MAS/Services/MailService.cs @@ -9,13 +9,14 @@ using System.Collections.Generic; using System.Text; using System.Threading.Tasks; +using System.Linq; namespace MAS.Services { public interface IMailService { Task CreateAndSendCampaignAsync(string subject, string previewText, string body); - string CreateEmailBody(IEnumerable item); + string CreateDailyEmailBody(IEnumerable item); } public class MailService: IMailService @@ -74,21 +75,10 @@ public async Task CreateAndSendCampaignAsync(string subject, string prev } - public string CreateEmailBody(IEnumerable items) + public string CreateDailyEmailBody(IEnumerable items) { - var body = new StringBuilder(); - - foreach (var item in items) - { - body.Append(item.Source.Title); - body.Append("
"); - body.Append(item.Title); - body.Append("
"); - body.Append(item.ShortSummary); - body.Append("


"); - } - - return body.ToString(); + var vm = new DailyEmail() { Items = items.ToList() }; + return vm.HTML; } } } diff --git a/lambda/MAS/Services/S3Service.cs b/lambda/MAS/Services/S3Service.cs index 6459eeb3..110314f7 100644 --- a/lambda/MAS/Services/S3Service.cs +++ b/lambda/MAS/Services/S3Service.cs @@ -67,7 +67,7 @@ private string CreateContentBody(Item item) contentBody.Append(Environment.NewLine); contentBody.Append("UKMI Comment: "); - contentBody.Append(item.UKMiComment); + contentBody.Append(item.Comment); contentBody.Append(Environment.NewLine); if (item.ResourceLinks != null) From fa92be8b65f0d6f2ff5f4a336e0946db50cef822 Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 2 Jan 2020 15:06:08 +0000 Subject: [PATCH 2/7] MAS-129 Fix test --- ...ontentControllerTests.PutCMSItemSavesItemIntoS3.approved.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lambda/MAS.Tests/IntergrationTests/ContentControllerTests.PutCMSItemSavesItemIntoS3.approved.txt b/lambda/MAS.Tests/IntergrationTests/ContentControllerTests.PutCMSItemSavesItemIntoS3.approved.txt index 09046c0a..d9851094 100644 --- a/lambda/MAS.Tests/IntergrationTests/ContentControllerTests.PutCMSItemSavesItemIntoS3.approved.txt +++ b/lambda/MAS.Tests/IntergrationTests/ContentControllerTests.PutCMSItemSavesItemIntoS3.approved.txt @@ -2,6 +2,6 @@ Title: Some title Short Summary: Wonder drug Source: The Journal of Medicine Evidence Type: Safety alerts -UKMI Comment: UKMI Comment +UKMI Comment: SPS Comment Resource Links:

Link 1

Link 2

\ No newline at end of file From 9d7d7d607ed839a09b2dc872b7e4a2d4337d2f32 Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 2 Jan 2020 15:09:56 +0000 Subject: [PATCH 3/7] MAS-129 Change variable name --- lambda/MAS/Services/MailService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lambda/MAS/Services/MailService.cs b/lambda/MAS/Services/MailService.cs index 680c2332..3ae0b1c1 100644 --- a/lambda/MAS/Services/MailService.cs +++ b/lambda/MAS/Services/MailService.cs @@ -77,8 +77,8 @@ public async Task CreateAndSendCampaignAsync(string subject, string prev public string CreateDailyEmailBody(IEnumerable items) { - var vm = new DailyEmail() { Items = items.ToList() }; - return vm.HTML; + var dailyEmail = new DailyEmail() { Items = items.ToList() }; + return dailyEmail.HTML; } } } From 794ce4fa27ae227346fb82dba367295e7e03a621 Mon Sep 17 00:00:00 2001 From: dylan Date: Fri, 3 Jan 2020 12:46:39 +0000 Subject: [PATCH 4/7] MAS-129 Add speciality to Lambda --- cms/models/Item.js | 1 + cms/routes/api/items.js | 2 + lambda/MAS.Tests/Feeds/multiple-items.json | 52 ++++++++++++++++++++-- lambda/MAS/Models/Item.cs | 3 ++ lambda/MAS/Models/Speciality.cs | 14 ++++++ 5 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 lambda/MAS/Models/Speciality.cs diff --git a/cms/models/Item.js b/cms/models/Item.js index ed8a44e8..ba9d9521 100644 --- a/cms/models/Item.js +++ b/cms/models/Item.js @@ -153,6 +153,7 @@ Item.schema.post("save", async function(doc, next) { item = await keystone.list("Item").model.findById(doc._id) .populate("source") .populate("evidenceType") + .populate("speciality") .exec(); } catch(err) { diff --git a/cms/routes/api/items.js b/cms/routes/api/items.js index a6a3536a..989ce2e9 100644 --- a/cms/routes/api/items.js +++ b/cms/routes/api/items.js @@ -7,6 +7,7 @@ exports.single = function(req, res) { .findById(req.params.itemId) .populate("source") .populate("evidenceType") + .populate("speciality") .exec(function(err, item) { if (err) return res.err(err); @@ -25,6 +26,7 @@ exports.list = function(req, res) { .find() .populate("source") .populate("evidenceType") + .populate("speciality") .exec(function(err, items) { if (err) return res.json({ err: err }); diff --git a/lambda/MAS.Tests/Feeds/multiple-items.json b/lambda/MAS.Tests/Feeds/multiple-items.json index 7a9de604..b3c79e84 100644 --- a/lambda/MAS.Tests/Feeds/multiple-items.json +++ b/lambda/MAS.Tests/Feeds/multiple-items.json @@ -16,7 +16,18 @@ "publicationDate": "2019-11-25T13:48:36.000Z", "createdDate": "2019-10-22T15:05:05.927Z", "speciality": [ - "5daf1a5c8a34d485cb05b5ba" + { + "_id": "5e0e4331200a585f718e1ee5", + "key": "be1c2e2f-745e-4a82-b5aa-d4cef4d31a1b", + "title": "Anaesthesia and pain", + "__v": 0 + }, + { + _id: "5e0e4331200a58dead8e1ee8", + key: "53fc67a4-46d8-4171-9447-7fcf216c8749", + title: "Complementary and alternative therapies", + __v: 0 + } ], "evidenceType": { "_id": "5df7abf383138898ee1f67ef", @@ -44,7 +55,18 @@ "publicationDate": "2019-11-23T13:48:36.000Z", "createdDate": "2019-10-23T10:38:43.000Z", "speciality": [ - "5daf1a5c8a34d478fd05b5d4" + { + "_id": "5e0e4331200a585f718e1ee5", + "key": "be1c2e2f-745e-4a82-b5aa-d4cef4d31a1b", + "title": "Anaesthesia and pain", + "__v": 0 + }, + { + _id: "5e0e4331200a58dead8e1ee8", + key: "53fc67a4-46d8-4171-9447-7fcf216c8749", + title: "Complementary and alternative therapies", + __v: 0 + } ], "evidenceType": { "_id": "5df7abf383138898ee1f67ef", @@ -72,7 +94,18 @@ "publicationDate": "2019-10-23T00:00:00.000Z", "createdDate": "2019-10-23T10:56:40.000Z", "speciality": [ - "5daf1a5c8a34d4d6e505b5b9" + { + "_id": "5e0e4331200a585f718e1ee5", + "key": "be1c2e2f-745e-4a82-b5aa-d4cef4d31a1b", + "title": "Anaesthesia and pain", + "__v": 0 + }, + { + _id: "5e0e4331200a58dead8e1ee8", + key: "53fc67a4-46d8-4171-9447-7fcf216c8749", + title: "Complementary and alternative therapies", + __v: 0 + } ], "evidenceType": { "_id": "5df7abf383138898ee1f67ef", @@ -100,7 +133,18 @@ "publicationDate": "2019-10-28T00:00:00.000Z", "createdDate": "2019-10-28T11:07:11.000Z", "speciality": [ - "5daf1a5c8a34d485cb05b5ba" + { + "_id": "5e0e4331200a585f718e1ee5", + "key": "be1c2e2f-745e-4a82-b5aa-d4cef4d31a1b", + "title": "Anaesthesia and pain", + "__v": 0 + }, + { + _id: "5e0e4331200a58dead8e1ee8", + key: "53fc67a4-46d8-4171-9447-7fcf216c8749", + title: "Complementary and alternative therapies", + __v: 0 + } ], "evidenceType": { "_id": "5df7abf383138898ee1f67ef", diff --git a/lambda/MAS/Models/Item.cs b/lambda/MAS/Models/Item.cs index a3ac21fe..3a938465 100644 --- a/lambda/MAS/Models/Item.cs +++ b/lambda/MAS/Models/Item.cs @@ -1,4 +1,5 @@ using Newtonsoft.Json; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace MAS.Models @@ -15,6 +16,8 @@ public class Item public Source Source { get; set; } [Required, JsonRequired] public EvidenceType EvidenceType { get; set; } + [JsonProperty("speciality")] + public List Speciality { get; set; } public string ShortSummary { get; set; } public string Comment { get; set; } public string ResourceLinks { get; set; } diff --git a/lambda/MAS/Models/Speciality.cs b/lambda/MAS/Models/Speciality.cs new file mode 100644 index 00000000..37b04f15 --- /dev/null +++ b/lambda/MAS/Models/Speciality.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MAS.Models +{ + public class Speciality + { + public string Title { get; set; } + + public string Key { get; set; } + } +} From 756da19bdc0cf7b936b20153e81d4ca0b7337b74 Mon Sep 17 00:00:00 2001 From: dylan Date: Fri, 3 Jan 2020 12:47:48 +0000 Subject: [PATCH 5/7] MAS-129 Add speciality field to MAD --- lambda/MAS/Models/DailyEmail.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lambda/MAS/Models/DailyEmail.cs b/lambda/MAS/Models/DailyEmail.cs index 56513417..8f37163a 100644 --- a/lambda/MAS/Models/DailyEmail.cs +++ b/lambda/MAS/Models/DailyEmail.cs @@ -9,7 +9,8 @@ namespace MAS.Models public class DailyEmail { public List Items { get; set; } - public List> GroupedItems + + public List> GroupedItems { get { @@ -17,6 +18,7 @@ public List> GroupedItems } } + public string HTML { get @@ -25,20 +27,27 @@ public string HTML foreach (var group in GroupedItems) { - var speciality = group.Single().EvidenceType.Title; - body.Append("" + speciality + ""); + var evidenceType = group.Single().EvidenceType.Title; + + body.Append("
"); + body.Append("" + evidenceType + ""); foreach(var item in group) { + body.Append("
"); + body.Append(item.Title); body.Append("
"); body.Append(item.Source.Title); body.Append("
"); - body.Append(item.Title); + body.Append(String.Join(" | ", item.Speciality.Select(x => x.Title))); body.Append("
"); body.Append(item.ShortSummary); body.Append("
"); body.Append("SPS Comment"); + body.Append("
"); } + + body.Append("
"); } return body.ToString(); From 6adbe1983dedac7b6a3dc8f5a6c42ae5d7210c1d Mon Sep 17 00:00:00 2001 From: dylan Date: Fri, 3 Jan 2020 13:33:29 +0000 Subject: [PATCH 6/7] MAS-129 DailyEmail refactor and tests --- lambda/MAS.Tests/UnitTests/DailyEmailTests.cs | 138 ++++++++++++++++++ lambda/MAS/Models/DailyEmail.cs | 6 +- 2 files changed, 141 insertions(+), 3 deletions(-) create mode 100644 lambda/MAS.Tests/UnitTests/DailyEmailTests.cs diff --git a/lambda/MAS.Tests/UnitTests/DailyEmailTests.cs b/lambda/MAS.Tests/UnitTests/DailyEmailTests.cs new file mode 100644 index 00000000..fbb1d11d --- /dev/null +++ b/lambda/MAS.Tests/UnitTests/DailyEmailTests.cs @@ -0,0 +1,138 @@ +using MAS.Models; +using MAS.Tests.Infrastructure; +using Shouldly; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Xunit; + +namespace MAS.Tests.UnitTests +{ + public class DailyEmailTests : TestBase + { + Item exampleItem = new Item() + { + Id = "123", + Title = "Some Title", + Slug = "abc", + ShortSummary = "Some short summary", + ResourceLinks = "", + Comment = "", + Speciality = new List + { + new Speciality() + { + Key = "1a", + Title = "Some speciality", + + } + }, + EvidenceType = new EvidenceType() + { + Key = "1b", + Title = "Some evidence type" + }, + Source = new Source() + { + Id = "1c", + Title = "Some source" + } + }; + Item exampleItem2 = new Item() + { + Id = "123", + Title = "Some Title", + Slug = "abc", + ShortSummary = "Some short summary", + ResourceLinks = "", + Comment = "", + Speciality = new List + { + new Speciality() + { + Key = "1a", + Title = "Some speciality 2", + + } + }, + EvidenceType = new EvidenceType() + { + Key = "1c", + Title = "Some evidence type 2" + }, + Source = new Source() + { + Id = "1c", + Title = "Some source" + } + }; + + [Fact] + public void CanCreateSingleItemEmail() + { + var email = new DailyEmail() + { + Items = new List() + { + exampleItem + } + }; + + var expectedHtml = "
Some evidence type
Some Title
Some source
Some speciality
Some short summary
SPS Comment
"; + email.HTML.ShouldBe(expectedHtml); + + } + + [Fact] + public void CanCreateEmailWithTwoItemsSharingEvidenceType() + { + var email = new DailyEmail() + { + Items = new List() + { + exampleItem, + exampleItem + } + }; + + var expectedHtml = "
Some evidence type
Some Title
Some source
Some speciality
Some short summary
SPS Comment
Some Title
Some source
Some speciality
Some short summary
SPS Comment
"; + email.HTML.ShouldBe(expectedHtml); + + } + + [Fact] + public void CanCreateEmailWithTwoItemsDifferentEvidenceType() + { + var email = new DailyEmail() + { + Items = new List() + { + exampleItem, + exampleItem2 + } + }; + + var expectedHtml = "
Some evidence type
Some Title
Some source
Some speciality
Some short summary
SPS Comment
Some evidence type 2
Some Title
Some source
Some speciality 2
Some short summary
SPS Comment
"; + email.HTML.ShouldBe(expectedHtml); + + } + + [Fact] + public void ItemsWithManySpecialitiesRenderCorrectly() + { + exampleItem.Speciality.Add(new Speciality() { Key = "abcd", Title = "Another speciality" }); + var email = new DailyEmail() + { + Items = new List() + { + exampleItem + } + }; + + var expectedHtml = "
Some evidence type
Some Title
Some source
Some speciality | Another speciality
Some short summary
SPS Comment
"; + email.HTML.ShouldBe(expectedHtml); + + } + } +} diff --git a/lambda/MAS/Models/DailyEmail.cs b/lambda/MAS/Models/DailyEmail.cs index 8f37163a..1eb8d1eb 100644 --- a/lambda/MAS/Models/DailyEmail.cs +++ b/lambda/MAS/Models/DailyEmail.cs @@ -10,11 +10,11 @@ public class DailyEmail { public List Items { get; set; } - public List> GroupedItems + public List> GroupedItems { get { - return Items.GroupBy(x => x.EvidenceType).ToList(); + return Items.GroupBy(x => x.EvidenceType.Title).ToList(); } } @@ -27,7 +27,7 @@ public string HTML foreach (var group in GroupedItems) { - var evidenceType = group.Single().EvidenceType.Title; + var evidenceType = group.Key; body.Append("
"); body.Append("" + evidenceType + ""); From 12df1d8ebdfd35b2c71b107bcdff24b4490dc303 Mon Sep 17 00:00:00 2001 From: dylan Date: Mon, 6 Jan 2020 14:58:05 +0000 Subject: [PATCH 7/7] MAS-129 Change assertion to ShouldMatchApproved --- ...teEmailWithTwoItemsDifferentEvidenceType.approved.txt | 1 + ...eateEmailWithTwoItemsSharingEvidenceType.approved.txt | 1 + ...DailyEmailTests.CanCreateSingleItemEmail.approved.txt | 1 + ...ItemsWithManySpecialitiesRenderCorrectly.approved.txt | 1 + lambda/MAS.Tests/UnitTests/DailyEmailTests.cs | 9 +++++---- 5 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateEmailWithTwoItemsDifferentEvidenceType.approved.txt create mode 100644 lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateEmailWithTwoItemsSharingEvidenceType.approved.txt create mode 100644 lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateSingleItemEmail.approved.txt create mode 100644 lambda/MAS.Tests/UnitTests/DailyEmailTests.ItemsWithManySpecialitiesRenderCorrectly.approved.txt diff --git a/lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateEmailWithTwoItemsDifferentEvidenceType.approved.txt b/lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateEmailWithTwoItemsDifferentEvidenceType.approved.txt new file mode 100644 index 00000000..9e1af1a5 --- /dev/null +++ b/lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateEmailWithTwoItemsDifferentEvidenceType.approved.txt @@ -0,0 +1 @@ +
Some evidence type
Some Title
Some source
Some speciality
Some short summary
SPS Comment
Some evidence type 2
Some Title
Some source
Some speciality 2
Some short summary
SPS Comment
\ No newline at end of file diff --git a/lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateEmailWithTwoItemsSharingEvidenceType.approved.txt b/lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateEmailWithTwoItemsSharingEvidenceType.approved.txt new file mode 100644 index 00000000..16005a8a --- /dev/null +++ b/lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateEmailWithTwoItemsSharingEvidenceType.approved.txt @@ -0,0 +1 @@ +
Some evidence type
Some Title
Some source
Some speciality
Some short summary
SPS Comment
Some Title
Some source
Some speciality
Some short summary
SPS Comment
\ No newline at end of file diff --git a/lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateSingleItemEmail.approved.txt b/lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateSingleItemEmail.approved.txt new file mode 100644 index 00000000..fd61b616 --- /dev/null +++ b/lambda/MAS.Tests/UnitTests/DailyEmailTests.CanCreateSingleItemEmail.approved.txt @@ -0,0 +1 @@ +
Some evidence type
Some Title
Some source
Some speciality
Some short summary
SPS Comment
\ No newline at end of file diff --git a/lambda/MAS.Tests/UnitTests/DailyEmailTests.ItemsWithManySpecialitiesRenderCorrectly.approved.txt b/lambda/MAS.Tests/UnitTests/DailyEmailTests.ItemsWithManySpecialitiesRenderCorrectly.approved.txt new file mode 100644 index 00000000..bbb5efda --- /dev/null +++ b/lambda/MAS.Tests/UnitTests/DailyEmailTests.ItemsWithManySpecialitiesRenderCorrectly.approved.txt @@ -0,0 +1 @@ +
Some evidence type
Some Title
Some source
Some speciality | Another speciality
Some short summary
SPS Comment
\ No newline at end of file diff --git a/lambda/MAS.Tests/UnitTests/DailyEmailTests.cs b/lambda/MAS.Tests/UnitTests/DailyEmailTests.cs index fbb1d11d..1bb42492 100644 --- a/lambda/MAS.Tests/UnitTests/DailyEmailTests.cs +++ b/lambda/MAS.Tests/UnitTests/DailyEmailTests.cs @@ -80,7 +80,8 @@ public void CanCreateSingleItemEmail() }; var expectedHtml = "
Some evidence type
Some Title
Some source
Some speciality
Some short summary
SPS Comment
"; - email.HTML.ShouldBe(expectedHtml); + + expectedHtml.ShouldMatchApproved(email.HTML); } @@ -97,7 +98,7 @@ public void CanCreateEmailWithTwoItemsSharingEvidenceType() }; var expectedHtml = "
Some evidence type
Some Title
Some source
Some speciality
Some short summary
SPS Comment
Some Title
Some source
Some speciality
Some short summary
SPS Comment
"; - email.HTML.ShouldBe(expectedHtml); + expectedHtml.ShouldMatchApproved(email.HTML); } @@ -114,7 +115,7 @@ public void CanCreateEmailWithTwoItemsDifferentEvidenceType() }; var expectedHtml = "
Some evidence type
Some Title
Some source
Some speciality
Some short summary
SPS Comment
Some evidence type 2
Some Title
Some source
Some speciality 2
Some short summary
SPS Comment
"; - email.HTML.ShouldBe(expectedHtml); + expectedHtml.ShouldMatchApproved(email.HTML); } @@ -131,7 +132,7 @@ public void ItemsWithManySpecialitiesRenderCorrectly() }; var expectedHtml = "
Some evidence type
Some Title
Some source
Some speciality | Another speciality
Some short summary
SPS Comment
"; - email.HTML.ShouldBe(expectedHtml); + expectedHtml.ShouldMatchApproved(email.HTML); } }