• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

luttje / Key2Joy / 6557152774

18 Oct 2023 06:36AM UTC coverage: 52.519% (+39.8%) from 12.718%
6557152774

push

github

web-flow
Adding more tests, fixing bugs in the process (#48)

* Add config manager tests

* legacy config and mapping profile tests (should fix #42)

* remove comment, problem was caused by transfer across appdomain (or to/fro scripting environment)

* Test core functionality #48 + includes minor refactoring to be able to test + added docs

* Add interop tests + implement and test async test utility (refactors away from singletons)

* fix not all tests running in workflow

* config and interop tests

* Refactor and allow mocking global input hook class

* add capture action test

* Make Execute override optional for script only methods

* add dependency injection + refactor and try test gamepad service

* Refactor config singleton to using dependency injection

* add tests for scripting

* add tests for plugin set + fix plugin showing as loaded even if checksum match failed

* fix tests failing because it relied on config exist (I guess the test order was accidentally correct earlier, this means we should really fix cleanup so we catch this sooner)

* refactor docs code + fix wrong enum summary

* refactor docs builder and start testing it a bit

* fix cmd project structure

* ignore designer files in tests

* cleanup and refactor UI code + show latest version in help

* truncate listview action column

* allow user config to minimize app when pressing X (defaults to shut down app) resolves #45

696 of 1757 branches covered (0.0%)

Branch coverage included in aggregate %.

4597 of 4597 new or added lines in 138 files covered. (100.0%)

3619 of 6459 relevant lines covered (56.03%)

17089.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.88
/Support/Key2Joy.Tests/Contracts/Util/StringExtensionsTests.cs
1
using System;
2
using Key2Joy.Contracts.Util;
3
using Microsoft.VisualStudio.TestTools.UnitTesting;
4

5
namespace Key2Joy.Tests.Contracts.Util;
6

7
[TestClass]
8
public class StringExtensionsTests
9
{
10
    [TestMethod]
11
    public void Ellipsize_ReturnsInputString_WhenMaxLengthIsGreaterThanStringLength()
12
    {
13
        var input = "Hello, World!";
1✔
14
        var maxLength = 15;
1✔
15

16
        var result = input.Ellipsize(maxLength);
1✔
17

18
        Assert.AreEqual(input, result);
1✔
19
    }
1✔
20

21
    [TestMethod]
22
    public void Ellipsize_ReturnsTruncatedStringWithEllipsis_WhenMaxLengthIsLessThanStringLength()
23
    {
24
        var input = "This is a long text.";
1✔
25
        var maxLength = 10;
1✔
26
        var expectedResult = "This is...";
1✔
27

28
        var result = input.Ellipsize(maxLength);
1✔
29

30
        Assert.AreEqual(expectedResult, result);
1✔
31
    }
1✔
32

33
    [TestMethod]
34
    public void Ellipsize_ReturnsEmptyString_WhenInputStringIsEmpty()
35
    {
36
        var input = string.Empty;
1✔
37
        var maxLength = 5;
1✔
38

39
        var result = input.Ellipsize(maxLength);
1✔
40

41
        Assert.AreEqual(string.Empty, result);
1✔
42
    }
1✔
43

44
    [TestMethod]
45
    public void Ellipsize_ReturnsEllipsis_WhenMaxLengthIsEqualToStringLength()
46
    {
47
        var input = "Sample Text";
1✔
48
        var maxLength = input.Length;
1✔
49
        var expectedResult = "Sample Text";
1✔
50

51
        var result = input.Ellipsize(maxLength);
1✔
52

53
        Assert.AreEqual(expectedResult, result);
1✔
54
    }
1✔
55

56
    [TestMethod]
57
    [ExpectedException(typeof(ArgumentOutOfRangeException))]
58
    public void Ellipsize_Throws_WhenMaxLengthIsNegative()
59
    {
60
        var input = "Test";
1✔
61
        var maxLength = -5;
1✔
62

63
        input.Ellipsize(maxLength);
1✔
64
    }
×
65

66
    [TestMethod]
67
    public void Ellipsize_ReturnsEllipsis_WhenInputStringContainsOnlyWhitespace()
68
    {
69
        var input = "   ";
1✔
70
        var maxLength = 2;
1✔
71
        var expectedResult = "...";
1✔
72

73
        var result = input.Ellipsize(maxLength);
1✔
74

75
        Assert.AreEqual(expectedResult, result);
1✔
76
    }
1✔
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc