This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 505
/
OrientationSensor_Tests.cs
61 lines (56 loc) · 2.11 KB
/
OrientationSensor_Tests.cs
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
using Xamarin.Essentials;
using Xunit;
namespace Tests
{
public class OrientationSensor_Tests
{
[Fact]
public void OrientationSensor_Start() =>
Assert.Throws<NotImplementedInReferenceAssemblyException>(() => OrientationSensor.Stop());
[Fact]
public void OrientationSensor_Stop() =>
Assert.Throws<NotImplementedInReferenceAssemblyException>(() => OrientationSensor.Start(SensorSpeed.Default));
[Fact]
public void OrientationSensor_IsMonitoring() =>
Assert.False(OrientationSensor.IsMonitoring);
[Fact]
public void OrientationSensor_IsSupported() =>
Assert.Throws<NotImplementedInReferenceAssemblyException>(() => OrientationSensor.IsSupported);
[Theory]
[InlineData(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, true)]
[InlineData(0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, false)]
[InlineData(0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, false)]
[InlineData(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, false)]
[InlineData(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, false)]
public void OrientationSensorData_Comparison(
float x1,
float y1,
float z1,
float w1,
float x2,
float y2,
float z2,
float w2,
bool equals)
{
var data1 = new OrientationSensorData(x1, y1, z1, w1);
var data2 = new OrientationSensorData(x2, y2, z2, w2);
if (equals)
{
Assert.True(data1.Equals(data2));
Assert.True(data1 == data2);
Assert.False(data1 != data2);
Assert.Equal(data1, data2);
Assert.Equal(data1.GetHashCode(), data2.GetHashCode());
}
else
{
Assert.False(data1.Equals(data2));
Assert.False(data1 == data2);
Assert.True(data1 != data2);
Assert.NotEqual(data1, data2);
Assert.NotEqual(data1.GetHashCode(), data2.GetHashCode());
}
}
}
}