Skip to content

Commit 384fdaf

Browse files
committed
Fix tests (#1487)
1 parent a48cd84 commit 384fdaf

File tree

1 file changed

+11
-169
lines changed

1 file changed

+11
-169
lines changed

Daybreak.Tests/Services/BuildTemplateManagerTests.cs

Lines changed: 11 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Daybreak.Shared.Models.Builds;
22
using Daybreak.Shared.Models.Guildwars;
33
using Daybreak.Shared.Services.BuildTemplates;
4+
using Daybreak.Shared.Services.BuildTemplates.Parsers;
45
using FluentAssertions;
56
using Microsoft.Extensions.Logging;
67
using NSubstitute;
@@ -12,13 +13,14 @@ namespace Daybreak.Tests.Services;
1213
public class BuildTemplateManagerTests
1314
{
1415
private const string EncodedSingleTemplate = "OwBk0texXNu0Dj/z+TDzBj+TN4AE";
15-
private const string EncodedTeamTemplate = "OQJUAMxOEMLnw0nDXQGY6aw2B OQNCA8wDP9B8DyzmOUi1veC OggjYxXTIPWbp5krZfxEAAAoD OwUTM4HDn5gc9TJSh6xddmETA";
16+
private const string EncodedTeamTemplate = "OQJUAMxOEMLnw0nDXQGY6aw2B OQNCA8wDP9B8DyzmOUi1veC OggjcNWcIPWbp5krZfxEAAAoD OwUTAnHP45gc9TJSh6xddmETA";
1617
private BuildTemplateManager buildTemplateManager = default!;
1718

1819
[TestInitialize]
1920
public void Initialize()
2021
{
21-
this.buildTemplateManager = new BuildTemplateManager(Substitute.For<ILogger<BuildTemplateManager>>());
22+
ITemplateParser[] templateParsers = [new SkillTemplateParser(), new LegacySkillTemplateParser(), new PartyLoadoutTemplateParser()];
23+
this.buildTemplateManager = new BuildTemplateManager(templateParsers, Substitute.For<ILogger<BuildTemplateManager>>());
2224
}
2325

2426
[TestMethod]
@@ -30,14 +32,14 @@ public void TestSingleDecode()
3032
singleBuildEntry.Primary.Should().Be(Profession.Assassin);
3133
singleBuildEntry.Secondary.Should().Be(Profession.None);
3234
singleBuildEntry.Attributes.Count.Should().Be(4);
33-
singleBuildEntry.Attributes[1].Attribute.Should().Be(Attribute.DaggerMastery);
34-
singleBuildEntry.Attributes[1].Points.Should().Be(11);
35-
singleBuildEntry.Attributes[2].Attribute.Should().Be(Attribute.DeadlyArts);
36-
singleBuildEntry.Attributes[2].Points.Should().Be(1);
37-
singleBuildEntry.Attributes[3].Attribute.Should().Be(Attribute.ShadowArts);
38-
singleBuildEntry.Attributes[3].Points.Should().Be(5);
39-
singleBuildEntry.Attributes[0].Attribute.Should().Be(Attribute.CriticalStrikes);
35+
singleBuildEntry.Attributes[0].Attribute.Should().Be(Attribute.DaggerMastery);
4036
singleBuildEntry.Attributes[0].Points.Should().Be(11);
37+
singleBuildEntry.Attributes[1].Attribute.Should().Be(Attribute.DeadlyArts);
38+
singleBuildEntry.Attributes[1].Points.Should().Be(1);
39+
singleBuildEntry.Attributes[2].Attribute.Should().Be(Attribute.ShadowArts);
40+
singleBuildEntry.Attributes[2].Points.Should().Be(5);
41+
singleBuildEntry.Attributes[3].Attribute.Should().Be(Attribute.CriticalStrikes);
42+
singleBuildEntry.Attributes[3].Points.Should().Be(11);
4143
singleBuildEntry.Skills.Count.Should().Be(8);
4244
singleBuildEntry.Skills[0].Should().Be(Skill.UnsuspectingStrike);
4345
singleBuildEntry.Skills[1].Should().Be(Skill.WildStrike);
@@ -73,26 +75,11 @@ public void TestTeamDecode()
7375
Points = 11
7476
},
7577
new AttributeEntry
76-
{
77-
Attribute = Attribute.IllusionMagic,
78-
Points = 0
79-
},
80-
new AttributeEntry
8178
{
8279
Attribute = Attribute.InspirationMagic,
8380
Points = 2
8481
},
8582
new AttributeEntry
86-
{
87-
Attribute = Attribute.BeastMastery,
88-
Points = 0
89-
},
90-
new AttributeEntry
91-
{
92-
Attribute = Attribute.Marksmanship,
93-
Points = 0
94-
},
95-
new AttributeEntry
9683
{
9784
Attribute = Attribute.WildernessSurvival,
9885
Points = 12
@@ -121,35 +108,10 @@ public void TestTeamDecode()
121108
Points = 12
122109
},
123110
new AttributeEntry
124-
{
125-
Attribute = Attribute.DominationMagic,
126-
Points = 0
127-
},
128-
new AttributeEntry
129-
{
130-
Attribute = Attribute.IllusionMagic,
131-
Points = 0
132-
},
133-
new AttributeEntry
134111
{
135112
Attribute = Attribute.InspirationMagic,
136113
Points = 12
137114
},
138-
new AttributeEntry
139-
{
140-
Attribute = Attribute.HealingPrayers,
141-
Points = 0
142-
},
143-
new AttributeEntry
144-
{
145-
Attribute = Attribute.SmitingPrayers,
146-
Points = 0
147-
},
148-
new AttributeEntry
149-
{
150-
Attribute = Attribute.ProtectionPrayers,
151-
Points = 0
152-
},
153115
]);
154116
secondBuild.Skills.Should().BeEquivalentTo(
155117
[
@@ -179,26 +141,6 @@ public void TestTeamDecode()
179141
Points = 12
180142
},
181143
new AttributeEntry
182-
{
183-
Attribute = Attribute.Marksmanship,
184-
Points = 0
185-
},
186-
new AttributeEntry
187-
{
188-
Attribute = Attribute.WildernessSurvival,
189-
Points = 0
190-
},
191-
new AttributeEntry
192-
{
193-
Attribute = Attribute.ChannelingMagic,
194-
Points = 0
195-
},
196-
new AttributeEntry
197-
{
198-
Attribute = Attribute.Communing,
199-
Points = 0
200-
},
201-
new AttributeEntry
202144
{
203145
Attribute = Attribute.RestorationMagic,
204146
Points = 12
@@ -227,31 +169,11 @@ public void TestTeamDecode()
227169
Points = 3
228170
},
229171
new AttributeEntry
230-
{
231-
Attribute = Attribute.HealingPrayers,
232-
Points = 0
233-
},
234-
new AttributeEntry
235-
{
236-
Attribute = Attribute.SmitingPrayers,
237-
Points = 0
238-
},
239-
new AttributeEntry
240172
{
241173
Attribute = Attribute.ProtectionPrayers,
242174
Points = 12
243175
},
244176
new AttributeEntry
245-
{
246-
Attribute = Attribute.DominationMagic,
247-
Points = 0
248-
},
249-
new AttributeEntry
250-
{
251-
Attribute = Attribute.IllusionMagic,
252-
Points = 0
253-
},
254-
new AttributeEntry
255177
{
256178
Attribute = Attribute.InspirationMagic,
257179
Points = 12
@@ -339,26 +261,11 @@ public void TestTeamEncode()
339261
Points = 11
340262
},
341263
new AttributeEntry
342-
{
343-
Attribute = Attribute.IllusionMagic,
344-
Points = 0
345-
},
346-
new AttributeEntry
347264
{
348265
Attribute = Attribute.InspirationMagic,
349266
Points = 2
350267
},
351268
new AttributeEntry
352-
{
353-
Attribute = Attribute.BeastMastery,
354-
Points = 0
355-
},
356-
new AttributeEntry
357-
{
358-
Attribute = Attribute.Marksmanship,
359-
Points = 0
360-
},
361-
new AttributeEntry
362269
{
363270
Attribute = Attribute.WildernessSurvival,
364271
Points = 12
@@ -386,35 +293,10 @@ public void TestTeamEncode()
386293
Points = 12
387294
},
388295
new AttributeEntry
389-
{
390-
Attribute = Attribute.DominationMagic,
391-
Points = 0
392-
},
393-
new AttributeEntry
394-
{
395-
Attribute = Attribute.IllusionMagic,
396-
Points = 0
397-
},
398-
new AttributeEntry
399296
{
400297
Attribute = Attribute.InspirationMagic,
401298
Points = 12
402299
},
403-
new AttributeEntry
404-
{
405-
Attribute = Attribute.HealingPrayers,
406-
Points = 0
407-
},
408-
new AttributeEntry
409-
{
410-
Attribute = Attribute.SmitingPrayers,
411-
Points = 0
412-
},
413-
new AttributeEntry
414-
{
415-
Attribute = Attribute.ProtectionPrayers,
416-
Points = 0
417-
},
418300
],
419301
Skills = [
420302
Skill.SymbolicCelerity,
@@ -443,26 +325,6 @@ public void TestTeamEncode()
443325
Points = 12
444326
},
445327
new AttributeEntry
446-
{
447-
Attribute = Attribute.Marksmanship,
448-
Points = 0
449-
},
450-
new AttributeEntry
451-
{
452-
Attribute = Attribute.WildernessSurvival,
453-
Points = 0
454-
},
455-
new AttributeEntry
456-
{
457-
Attribute = Attribute.ChannelingMagic,
458-
Points = 0
459-
},
460-
new AttributeEntry
461-
{
462-
Attribute = Attribute.Communing,
463-
Points = 0
464-
},
465-
new AttributeEntry
466328
{
467329
Attribute = Attribute.RestorationMagic,
468330
Points = 12
@@ -490,31 +352,11 @@ public void TestTeamEncode()
490352
Points = 3
491353
},
492354
new AttributeEntry
493-
{
494-
Attribute = Attribute.HealingPrayers,
495-
Points = 0
496-
},
497-
new AttributeEntry
498-
{
499-
Attribute = Attribute.SmitingPrayers,
500-
Points = 0
501-
},
502-
new AttributeEntry
503355
{
504356
Attribute = Attribute.ProtectionPrayers,
505357
Points = 12
506358
},
507359
new AttributeEntry
508-
{
509-
Attribute = Attribute.DominationMagic,
510-
Points = 0
511-
},
512-
new AttributeEntry
513-
{
514-
Attribute = Attribute.IllusionMagic,
515-
Points = 0
516-
},
517-
new AttributeEntry
518360
{
519361
Attribute = Attribute.InspirationMagic,
520362
Points = 12

0 commit comments

Comments
 (0)