|
22 | 22 |
|
23 | 23 | namespace MAS.Tests.IntergrationTests |
24 | 24 | { |
25 | | - public class FakeController : Microsoft.AspNetCore.Mvc.Controller |
26 | | - { |
| 25 | + //public class FakeMailChimpManager : IMailChimpManager |
| 26 | + //{ |
27 | 27 |
|
28 | | - } |
| 28 | + //} |
29 | 29 |
|
30 | 30 | public class DailyEmailTests : TestBase |
31 | 31 | { |
32 | | - IMailService MailService; |
33 | | - |
34 | | - public DailyEmailTests(IMailService mailService) |
35 | | - { |
36 | 32 |
|
37 | | - MailService = mailService; |
38 | | - } |
39 | 33 |
|
40 | | - public override void Dispose() |
| 34 | + public DailyEmailTests() |
41 | 35 | { |
42 | | - |
43 | 36 | } |
44 | 37 |
|
45 | 38 | Item exampleItem = new Item() |
@@ -99,56 +92,82 @@ public override void Dispose() |
99 | 92 | } |
100 | 93 | }; |
101 | 94 |
|
102 | | - //[Fact] |
103 | | - //public void CanCreateSingleItemEmail() |
104 | | - //{ |
| 95 | + [Fact] |
| 96 | + public async void SomeTest() |
| 97 | + { |
| 98 | + var fakeMailService = new Mock<IMailService>(); |
| 99 | + |
| 100 | + string bodyHtml = string.Empty; |
| 101 | + fakeMailService.Setup(s => s.CreateAndSendDailyAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) |
| 102 | + .Callback<string, string, string>((subject, previewText, body) => bodyHtml = body) |
| 103 | + .ReturnsAsync("1234"); |
| 104 | + |
| 105 | + WithImplementation(fakeMailService); |
| 106 | + |
| 107 | + await _client.PutAsync("/api/mail/daily", null); |
| 108 | + |
| 109 | + bodyHtml.ShouldMatchApproved(); |
| 110 | + } |
| 111 | + |
105 | 112 |
|
106 | | - // var items = new List<Item> { exampleItem }; |
107 | | - // var actualHtml = this.MailService.CreateDailyEmailBody(items, mockController.Object); |
108 | 113 |
|
109 | | - // actualHtml.ShouldMatchApproved(); |
110 | 114 |
|
111 | | - //} |
112 | 115 |
|
113 | | - //[Fact] |
114 | | - //public void CanCreateEmailWithTwoItemsSharingEvidenceType() |
115 | | - //{ |
116 | | - // var items = new List<Item> { exampleItem, exampleItem }; |
117 | | - // var actualHtml = this.MailService.CreateDailyEmailBody(items, new FakeController()); |
118 | 116 |
|
119 | | - // actualHtml.ShouldMatchApproved(); |
120 | 117 |
|
121 | | - //} |
122 | 118 |
|
123 | | - //[Fact] |
124 | | - //public void CanCreateEmailWithTwoItemsDifferentEvidenceType() |
125 | | - //{ |
126 | | - // var items = new List<Item> { exampleItem, exampleItem2 }; |
127 | | - // var actualHtml = ""; |
128 | | - // try |
129 | | - // { |
130 | | - // actualHtml = this.MailService.CreateDailyEmailBody(items, new FakeController()); |
131 | | - // } |
132 | | - // catch(Exception e) |
133 | | - // { |
134 | | - // var p = e.Message; |
135 | | - // } |
136 | | - |
137 | 119 |
|
138 | | - // actualHtml.ShouldMatchApproved(); |
139 | 120 |
|
140 | | - //} |
| 121 | + //[Fact] |
| 122 | + //public void CanCreateSingleItemEmail() |
| 123 | + //{ |
141 | 124 |
|
142 | | - //[Fact] |
143 | | - //public void ItemsWithManySpecialitiesRenderCorrectly() |
144 | | - //{ |
145 | | - // exampleItem.Specialities.Add(new Speciality() { Key = "abcd", Title = "Another speciality" }); |
146 | | - // var items = new List<Item> { exampleItem }; |
147 | | - // var actualHtml = this.MailService.CreateDailyEmailBody(items, new FakeController()); |
| 125 | + // var items = new List<Item> { exampleItem }; |
| 126 | + // var actualHtml = this.MailService.CreateDailyEmailBody(items, mockController.Object); |
148 | 127 |
|
149 | | - // actualHtml.ShouldMatchApproved(); |
| 128 | + // actualHtml.ShouldMatchApproved(); |
150 | 129 |
|
151 | | - //} |
| 130 | + //} |
152 | 131 |
|
153 | | - } |
| 132 | + //[Fact] |
| 133 | + //public void CanCreateEmailWithTwoItemsSharingEvidenceType() |
| 134 | + //{ |
| 135 | + // var items = new List<Item> { exampleItem, exampleItem }; |
| 136 | + // var actualHtml = this.MailService.CreateDailyEmailBody(items, new FakeController()); |
| 137 | + |
| 138 | + // actualHtml.ShouldMatchApproved(); |
| 139 | + |
| 140 | + //} |
| 141 | + |
| 142 | + //[Fact] |
| 143 | + //public void CanCreateEmailWithTwoItemsDifferentEvidenceType() |
| 144 | + //{ |
| 145 | + // var items = new List<Item> { exampleItem, exampleItem2 }; |
| 146 | + // var actualHtml = ""; |
| 147 | + // try |
| 148 | + // { |
| 149 | + // actualHtml = this.MailService.CreateDailyEmailBody(items, new FakeController()); |
| 150 | + // } |
| 151 | + // catch(Exception e) |
| 152 | + // { |
| 153 | + // var p = e.Message; |
| 154 | + // } |
| 155 | + |
| 156 | + |
| 157 | + // actualHtml.ShouldMatchApproved(); |
| 158 | + |
| 159 | + //} |
| 160 | + |
| 161 | + //[Fact] |
| 162 | + //public void ItemsWithManySpecialitiesRenderCorrectly() |
| 163 | + //{ |
| 164 | + // exampleItem.Specialities.Add(new Speciality() { Key = "abcd", Title = "Another speciality" }); |
| 165 | + // var items = new List<Item> { exampleItem }; |
| 166 | + // var actualHtml = this.MailService.CreateDailyEmailBody(items, new FakeController()); |
| 167 | + |
| 168 | + // actualHtml.ShouldMatchApproved(); |
| 169 | + |
| 170 | + //} |
| 171 | + |
| 172 | + } |
154 | 173 | } |
0 commit comments