-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUnitTestBoolean.cs
More file actions
49 lines (39 loc) · 1.73 KB
/
Copy pathUnitTestBoolean.cs
File metadata and controls
49 lines (39 loc) · 1.73 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
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Mayerch1.GithubUpdateCheck;
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
namespace GithubUpdateCheckTest
{
/// <summary>
/// Unit test of the GithubUpdateCheck. Tests CompareType.Boolean specific functionality
/// As the update checker needs a connection to github for almost all funcionality, this is closer to an integration test than a unit test
/// This unit test can take more than 20s runtime
/// </summary>
[TestClass]
[ExcludeFromCodeCoverage]
public class UnitTestBoolean
{
[TestMethod]
public void TestInvalidPattern()
{
GithubUpdateCheck obj = new GithubUpdateCheck("Mayerch1", "GithubUpdateCheckUnitTest", CompareType.Boolean);
// this is the only invalid input
Assert.ThrowsException<InvalidVersionException>(() => obj.IsUpdateAvailable(null));
}
[TestMethod]
public void TestUpdateAvailable()
{
GithubUpdateCheck obj = new GithubUpdateCheck("Mayerch1", "GithubUpdateCheckUnitTest", CompareType.Boolean);
// the repo is guaranteed to have this version as latest patch ("v.2.4.1.5")
// the slightest difference shall assume an update, the strings are not normalized
Assert.IsTrue(obj.IsUpdateAvailable("2.4.1.5"));
}
[TestMethod]
public void TestNoUpdateAvailable()
{
GithubUpdateCheck obj = new GithubUpdateCheck("Mayerch1", "GithubUpdateCheckUnitTest", CompareType.Boolean);
// the repo is guaranteed to have this version as latest patch ("v.2.4.1.5")
Assert.IsFalse(obj.IsUpdateAvailable("v.2.4.1.5"));
}
}
}