~ruther/NosSmooth

ref: 3e52548e23c46738ce2194dd02c79fdce85959c3 NosSmooth/Tests/NosSmooth.Game.Tests/Modules/SkillsTests.cs -rw-r--r-- 2.6 KiB
3e52548e — František Boháček feat(core): split raw client and managed client as well as packet handlers 2 years ago
                                                                                
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
//
//  SkillsTests.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Xunit.Abstractions;

namespace NosSmooth.Game.Tests.Modules;

/// <summary>
/// Tests for Game.Skills.
/// </summary>
public class SkillsTests
{
    private readonly ITestOutputHelper _testOutputHelper;

    /// <summary>
    /// Initializes a new instance of the <see cref="SkillsTests"/> class.
    /// </summary>
    /// <param name="testOutputHelper">The test output helper.</param>
    public SkillsTests(ITestOutputHelper testOutputHelper)
    {
        _testOutputHelper = testOutputHelper;
    }

    /// <summary>
    /// Tests packets from init_morph_use.log.
    /// </summary>
    /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
    [Fact]
    public async Task Init_Morph_Use()
    {
        var data = PacketFileClient.CreateFor<SkillsTests>("init_morph_use", _testOutputHelper);

        data.Game.Skills.ShouldBeNull();

        await data.Client.ExecuteUntilLabelAsync("AFTER_SKILLS_INITIALIZED");

        data.Game.Skills.ShouldNotBeNull();
        data.Game.Skills.PrimarySkill.SkillVNum.ShouldBe(240);
        data.Game.Skills.SecondarySkill.SkillVNum.ShouldBe(241);
        data.Game.Skills.OtherSkills.ShouldNotBeEmpty();
        data.Game.Skills.OtherSkills.Count.ShouldBe(3);
        data.Game.Skills.OtherSkills.Last().SkillVNum.ShouldBe(236);

        await data.Client.ExecuteUntilLabelAsync("AFTER_MORPH");

        data.Game.Skills.ShouldNotBeNull();
        data.Game.Skills.PrimarySkill.SkillVNum.ShouldBe(922);
        data.Game.Skills.SecondarySkill.SkillVNum.ShouldBe(922);
        data.Game.Skills.OtherSkills.Count.ShouldBe(11);
        data.Game.Skills.OtherSkills.ShouldAllBe(x => x.SkillVNum > 921 && x.SkillVNum < 933);

        await data.Client.ExecuteUntilLabelAsync("AFTER_MORPH_OFF");

        data.Game.Skills.ShouldNotBeNull();
        data.Game.Skills.PrimarySkill.SkillVNum.ShouldBe(240);
        data.Game.Skills.SecondarySkill.SkillVNum.ShouldBe(241);
        data.Game.Skills.OtherSkills.ShouldNotBeEmpty();
        data.Game.Skills.OtherSkills.Count.ShouldBe(3);
        data.Game.Skills.OtherSkills.Last().SkillVNum.ShouldBe(236);

        await data.Client.ExecuteUntilLabelAsync("AFTER_SKILL_USED");

        data.Game.Skills.ShouldNotBeNull();
        data.Game.Skills.PrimarySkill.IsOnCooldown.ShouldBeTrue();

        await data.Client.ExecuteUntilLabelAsync("AFTER_SKILL_REFRESHED");

        data.Game.Skills.ShouldNotBeNull();
        data.Game.Skills.PrimarySkill.IsOnCooldown.ShouldBeFalse();
    }
}
Do not follow this link