This repository was archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 493
Expand file tree
/
Copy pathVibration_Tests.cs
More file actions
46 lines (42 loc) · 1.37 KB
/
Vibration_Tests.cs
File metadata and controls
46 lines (42 loc) · 1.37 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
using System;
using Xamarin.Essentials;
using Xunit;
namespace DeviceTests
{
public class Vibration_Tests
{
[Fact]
public void Vibrate()
{
#if __ANDROID__
// API 23+ we need user interaction for camera permission
// can't really test so easily on device.
if (Platform.HasApiLevel(Android.OS.BuildVersionCodes.M))
return;
#elif __IOS__
// TODO: remove this as soon as the test harness can filter
// the iOS simulator does not emulate a flashlight
if (DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DevicePlatform.iOS)
return;
#endif
Vibration.Vibrate();
}
[Fact]
public void Vibrate_Cancel()
{
#if __ANDROID__
// API 23+ we need user interaction for camera permission
// can't really test so easily on device.
if (Platform.HasApiLevel(Android.OS.BuildVersionCodes.M))
return;
#elif __IOS__
// TODO: remove this as soon as the test harness can filter
// the iOS simulator does not emulate a flashlight
if (DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DevicePlatform.iOS)
return;
#endif
Vibration.Vibrate();
Vibration.Cancel();
}
}
}