Skip to content

Commit fb20985

Browse files
authored
Merge pull request #56 from yungd1plomat/improve/platformfeatures
Improve Platform Features
2 parents 209bb89 + 29645e5 commit fb20985

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+691
-324
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ body:
5454
- ".NET Framework 4.8.x"
5555
- ".NET Standard 1.x"
5656
- ".NET Standard 2.x"
57+
- ".NET Core 5.0"
5758
- ".NET Core App 1.x"
5859
- ".NET Core App 2.x"
5960
- ".NET Core App 3.x"
@@ -89,6 +90,19 @@ body:
8990
- "Visual Studio 2015"
9091
- "Visual Studio 2012"
9192
- "Visual Studio 2010"
93+
- "Visual Studio Code"
94+
- "MonoDevelop 7.x"
95+
- "MonoDevelop 6.x"
96+
- "MonoDevelop 5.x"
97+
- "MonoDevelop 4.x"
98+
- "MonoDevelop 3.x"
99+
- "Rider 2023"
100+
- "Rider 2022"
101+
- "Rider 2021"
102+
- "Rider 2020"
103+
- "Rider 2019"
104+
- "Rider 2018"
105+
- "Rider 2017"
92106
- "Other"
93107
- type: textarea
94108
attributes:
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using Xunit;
3+
using AdvancedSharpAdbClient.Exceptions;
4+
5+
namespace AdvancedSharpAdbClient.Tests.Exceptions
6+
{
7+
/// <summary>
8+
/// Tests the <see cref="AdvancedSharpAdbClient.Exceptions.ExceptionExtensions"/> class.
9+
/// </summary>
10+
public class ExceptionExtensionsTests
11+
{
12+
[Theory]
13+
[InlineData(null)]
14+
[InlineData("")]
15+
[InlineData("name")]
16+
public void ThrowIfNullTest(string paramName)
17+
{
18+
foreach (object o in new[] { new object(), "", "argument" })
19+
{
20+
ExceptionExtensions.ThrowIfNull(o);
21+
ExceptionExtensions.ThrowIfNull(o, nameof(paramName));
22+
}
23+
24+
Assert.Equal(paramName, Assert.Throws<ArgumentNullException>(() => ExceptionExtensions.ThrowIfNull(null, paramName)).ParamName);
25+
}
26+
27+
[Fact]
28+
public void ThrowIfGreaterThanTest()
29+
{
30+
Assert.Equal(1, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfGreaterThan(1, 0)).ActualValue);
31+
Assert.Equal(1u, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfGreaterThan<uint>(1, 0)).ActualValue);
32+
Assert.Equal(1.000000001, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfGreaterThan(1.000000001, 1)).ActualValue);
33+
Assert.Equal(1.00001f, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfGreaterThan(1.00001f, 1)).ActualValue);
34+
35+
ExceptionExtensions.ThrowIfGreaterThan(1, 2);
36+
}
37+
38+
[Fact]
39+
public static void ThrowIfLessThanTest()
40+
{
41+
Assert.Equal(0, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfLessThan(0, 1)).ActualValue);
42+
Assert.Equal(0u, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfLessThan<uint>(0, 1)).ActualValue);
43+
Assert.Equal(1d, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfLessThan(1, 1.000000001)).ActualValue);
44+
Assert.Equal(1f, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfLessThan(1, 1.00001f)).ActualValue);
45+
46+
ExceptionExtensions.ThrowIfLessThan(2, 1);
47+
}
48+
49+
[Fact]
50+
public static void ThrowIfNegativeTest()
51+
{
52+
Assert.Equal(-1, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfNegative(-1)).ActualValue);
53+
54+
ExceptionExtensions.ThrowIfNegative(0);
55+
ExceptionExtensions.ThrowIfNegative(1);
56+
}
57+
58+
[Fact]
59+
public static void ThrowIfTest()
60+
{
61+
object obj = new();
62+
ObjectDisposedException ex = Assert.Throws<ObjectDisposedException>(
63+
() => ExceptionExtensions.ThrowIf(true, obj));
64+
65+
Assert.Equal("System.Object", ex.ObjectName);
66+
}
67+
}
68+
}

AdvancedSharpAdbClient.Tests/Receivers/EnvironmentVariablesReceiverTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Xunit;
2+
using AdvancedSharpAdbClient.DeviceCommands;
23

34
namespace AdvancedSharpAdbClient.Tests
45
{

0 commit comments

Comments
 (0)