-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathV28UpdateTest.cs
More file actions
100 lines (83 loc) · 3.07 KB
/
Copy pathV28UpdateTest.cs
File metadata and controls
100 lines (83 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using DragaliaAPI.Database.Entities;
using DragaliaAPI.Shared.MasterAsset;
using DragaliaAPI.Shared.MasterAsset.Models.Story;
namespace DragaliaAPI.Integration.Test.Features.SavefileUpdate;
public class V28UpdateTest : SavefileUpdateTestFixture
{
protected override int StartingVersion => 27;
public V28UpdateTest(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper)
: base(factory, outputHelper) { }
[Fact]
public async Task V28Update_UnlocksBothStoriesForDragonAtLevel30()
{
this.ApiContext.PlayerStoryState.Count(x => x.StoryType == StoryTypes.Dragon)
.Should()
.Be(0);
await this.AddRangeToDatabase([
new DbPlayerDragonReliability() { DragonId = DragonId.Arsene, Level = 30 },
]);
StoryData arseneStories = MasterAsset.DragonStories[(int)DragonId.Arsene];
this.ApiContext.ChangeTracker.Clear();
await this.LoadIndex();
List<DbPlayerStoryState> dragonStories = ApiContext
.PlayerStoryState.Where(x => x.StoryType == StoryTypes.Dragon)
.ToList();
dragonStories
.Should()
.Contain(x => x.StoryId == arseneStories.StoryIds[0])
.Which.Should()
.BeEquivalentTo(
new DbPlayerStoryState()
{
ViewerId = this.ViewerId,
StoryId = arseneStories.StoryIds[0],
StoryType = StoryTypes.Dragon,
State = StoryState.Unlocked,
}
);
dragonStories
.Should()
.Contain(x => x.StoryId == arseneStories.StoryIds[1])
.Which.Should()
.BeEquivalentTo(
new DbPlayerStoryState()
{
ViewerId = this.ViewerId,
StoryId = arseneStories.StoryIds[1],
StoryType = StoryTypes.Dragon,
State = StoryState.Unlocked,
}
);
}
[Fact]
public async Task V28Update_DoesNotDuplicateExistingStories()
{
await this.AddRangeToDatabase([
new DbPlayerDragonReliability() { DragonId = DragonId.Arsene, Level = 30 },
]);
StoryData arseneStories = MasterAsset.DragonStories[(int)DragonId.Arsene];
await this.AddRangeToDatabase([
new DbPlayerStoryState()
{
StoryId = arseneStories.StoryIds[0],
StoryType = StoryTypes.Dragon,
},
new DbPlayerStoryState()
{
StoryId = arseneStories.StoryIds[1],
StoryType = StoryTypes.Dragon,
},
]);
this.ApiContext.ChangeTracker.Clear();
await this.LoadIndex();
ApiContext
.PlayerStoryState.Where(x =>
x.StoryType == StoryTypes.Dragon
&& (
x.StoryId == arseneStories.StoryIds[0] || x.StoryId == arseneStories.StoryIds[1]
)
)
.Should()
.HaveCount(2);
}
}