Rebranding to Xamarin.Essentials (#152)
|
@ -31,4 +31,4 @@ Describe any non-bug related behavioral changes that may change how users app be
|
|||
- [ ] Has samples (if omitted, state reason in description)
|
||||
- [ ] Rebased on top of master at time of PR
|
||||
- [ ] Changes adhere to coding standard
|
||||
- [ ] Updated documentation ([see walkthrough](https://github.com/xamarin/Caboodle/wiki/Documenting-your-code-with-mdoc))
|
||||
- [ ] Updated documentation ([see walkthrough](https://github.com/xamarin/Xamarin.Essentials/wiki/Documenting-your-code-with-mdoc))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Contributing
|
||||
|
||||
Thanks you for your interest in contributing to Microsoft Caboodle! In this document we'll outline what you need to know about contributing and how to get started.
|
||||
Thanks you for your interest in contributing to Xamarin.Essentials! In this document we'll outline what you need to know about contributing and how to get started.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
|
@ -12,7 +12,7 @@ You will need to complete a Contribution License Agreement before any pull reque
|
|||
|
||||
## Contributing Code
|
||||
|
||||
Check out [A Beginner's Guide for Contributing to Microsoft Caboodle](https://github.com/xamarin/Caboodle/wiki/A-Beginner's-Guide-for-Contributing-to-Microsoft-Caboodle).
|
||||
Check out [A Beginner's Guide for Contributing to Xamarin.Essentials](https://github.com/xamarin/Xamarin.Essentials/wiki/A-Beginner's-Guide-for-Contributing-to-Xamarin.Essentials).
|
||||
|
||||
## Documentation - mdoc
|
||||
|
||||
|
@ -25,7 +25,7 @@ Every pull request which affects public types or members should include correspo
|
|||
|
||||
### Bug Fixes
|
||||
|
||||
If you're looking for something to fix, please browse [open issues](https://github.com/xamarin/Caboodle/issues).
|
||||
If you're looking for something to fix, please browse [open issues](https://github.com/xamarin/Xamarin.Essentials/issues).
|
||||
|
||||
Follow the style used by the [.NET Foundation](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md), with two primary exceptions:
|
||||
|
||||
|
@ -33,18 +33,18 @@ Follow the style used by the [.NET Foundation](https://github.com/dotnet/corefx/
|
|||
- We will **not** use `_` or `s_` as a prefix for internal or private field names
|
||||
- We will use `camelCaseFieldName` for naming internal or private fields in both instance and static implementations
|
||||
|
||||
Read and follow our [Pull Request template](https://github.com/xamarin/Caboodle/blob/master/PULL_REQUEST_TEMPLATE.md)
|
||||
Read and follow our [Pull Request template](https://github.com/xamarin/Xamarin.Essentials/blob/master/PULL_REQUEST_TEMPLATE.md)
|
||||
|
||||
### Proposals
|
||||
|
||||
To propose a change or new feature, review the guidance below and then [open an issue using this template](https://github.com/xamarin/Caboodle/issues/new).
|
||||
To propose a change or new feature, review the guidance below and then [open an issue using this template](https://github.com/xamarin/Xamarin.Essentials/issues/new).
|
||||
|
||||
#### Non-Starter Topics
|
||||
The following topics should generally not be proposed for discussion as they are non-starters:
|
||||
|
||||
* Large renames of APIs
|
||||
* Large non-backward-compatible breaking changes
|
||||
* Platform-Specifics which can be accomplished without changing Microsoft Caboodle
|
||||
* Platform-Specifics which can be accomplished without changing Xamarin.Essentials
|
||||
* Avoid clutter posts like "+1" which do not serve to further the conversation
|
||||
|
||||
#### Proposal States
|
||||
|
@ -52,21 +52,21 @@ The following topics should generally not be proposed for discussion as they are
|
|||
Open proposals are still under discussion. Please leave your concrete, constructive feedback on this proposal. +1s and other clutter posts which do not add to the discussion will be removed.
|
||||
|
||||
##### Accepted
|
||||
Accepted proposals are proposals that both the community and core Microsoft Caboodle agree should be a part of Microsoft Caboodle. These proposals are ready for implementation, but do not yet have a developer actively working on them. These proposals are available for anyone to work on, both community and the core Microsoft Caboodle team.
|
||||
Accepted proposals are proposals that both the community and core Xamarin.Essentials agree should be a part of Xamarin.Essentials. These proposals are ready for implementation, but do not yet have a developer actively working on them. These proposals are available for anyone to work on, both community and the core Xamarin.Essentials team.
|
||||
|
||||
If you wish to start working on an accepted proposal, please reply to the thread so we can mark you as the implementor and change the title to In Progress. This helps to avoid multiple people working on the same thing. If you decide to work on this proposal publicly, feel free to post a link to the branch as well for folks to follow along.
|
||||
|
||||
###### What "Accepted" does mean
|
||||
* Any community member is welcome to work on the idea.
|
||||
* The core Microsoft Caboodle team _may_ consider working on this idea on their own, but has not done so until it is marked "In Progress" with a team member assigned as the implementor.
|
||||
* The core Xamarin.Essentials team _may_ consider working on this idea on their own, but has not done so until it is marked "In Progress" with a team member assigned as the implementor.
|
||||
* Any pull request implementing the proposal will be welcomed with an API and code review.
|
||||
|
||||
###### What "Accepted" does not mean
|
||||
* The proposal will ever be implemented, either by a community member or by the core Microsoft Caboodle team.
|
||||
* The core Microsoft Caboodle team is committing to implementing a proposal, even if nobody else does. Accepted proposals simply mean that the core Microsoft Caboodle team and the community agree that this proposal should be a part of Microsoft Caboodle.
|
||||
* The proposal will ever be implemented, either by a community member or by the core Xamarin.Essentials team.
|
||||
* The core Xamarin.Essentials team is committing to implementing a proposal, even if nobody else does. Accepted proposals simply mean that the core Xamarin.Essentials team and the community agree that this proposal should be a part of Xamarin.Essentials.
|
||||
|
||||
##### In Progress
|
||||
Once a developer has begun work on a proposal, either from the core Microsoft Caboodle team or a community member, the proposal is marked as in progress with the implementors name and (possibly) a link to a development branch to follow along with progress.
|
||||
Once a developer has begun work on a proposal, either from the core Xamarin.Essentials team or a community member, the proposal is marked as in progress with the implementors name and (possibly) a link to a development branch to follow along with progress.
|
||||
|
||||
#### Rejected
|
||||
Rejected proposals will not be implemented or merged into Microsoft Caboodle. Once a proposal is rejected, the thread will be closed and the conversation is considered completed, pending considerable new information or changes.
|
||||
Rejected proposals will not be implemented or merged into Xamarin.Essentials. Once a proposal is rejected, the thread will be closed and the conversation is considered completed, pending considerable new information or changes.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Accelerometer_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Battery_Tests
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class BrowserTests
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Clipboard_Tests
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Compass_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Connectivity_Tests
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class DataTransfer_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Email_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class FileSystem_Tests
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Geocoding_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Gyroscope_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Magnetometer_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class PhoneDialer_Tests
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Microsoft.Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Preferences_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class SecureStorage_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Caboodle.Tests
|
||||
namespace Tests
|
||||
{
|
||||
public class Sms_Tests
|
||||
{
|
||||
|
|
30
Caboodle.sln
|
@ -7,43 +7,43 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
.gitignore = .gitignore
|
||||
Caboodle.ruleset = Caboodle.ruleset
|
||||
Xamarin.Essentials.ruleset = Xamarin.Essentials.ruleset
|
||||
README.md = README.md
|
||||
stylecop.json = stylecop.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{A14D061F-382D-4609-A3B0-E1D0BF7AB6AC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Caboodle", "Caboodle\Caboodle.csproj", "{63A4F6A1-48BF-4D32-AED7-82F605EDB042}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Essentials", "Xamarin.Essentials\Xamarin.Essentials.csproj", "{63A4F6A1-48BF-4D32-AED7-82F605EDB042}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Caboodle.Tests", "Caboodle.Tests\Caboodle.Tests.csproj", "{77C2F93D-6EB7-49F7-A74A-C80499EC206A}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{77C2F93D-6EB7-49F7-A74A-C80499EC206A}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{706C0487-6930-4E55-8720-C17D9FE6CA91}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Caboodle.Samples", "Samples\Caboodle.Samples\Caboodle.Samples.csproj", "{2550ED91-8AE1-4E9A-A964-C11515C8FA28}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples", "Samples\Samples\Samples.csproj", "{2550ED91-8AE1-4E9A-A964-C11515C8FA28}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caboodle.Samples.Android", "Samples\Caboodle.Samples.Android\Caboodle.Samples.Android.csproj", "{C1CD30D3-52CA-4F8E-8499-BE88567CA2F8}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Android", "Samples\Samples.Android\Samples.Android.csproj", "{C1CD30D3-52CA-4F8E-8499-BE88567CA2F8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caboodle.Samples.iOS", "Samples\Caboodle.Samples.iOS\Caboodle.Samples.iOS.csproj", "{E2571C97-C048-4F91-8BB3-546CF7410C4C}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.iOS", "Samples\Samples.iOS\Samples.iOS.csproj", "{E2571C97-C048-4F91-8BB3-546CF7410C4C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caboodle.Samples.UWP", "Samples\Caboodle.Samples.UWP\Caboodle.Samples.UWP.csproj", "{A0798FC9-AB9D-4CCA-AF44-71B7A4691D5A}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.UWP", "Samples\Samples.UWP\Samples.UWP.csproj", "{A0798FC9-AB9D-4CCA-AF44-71B7A4691D5A}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DeviceTests", "DeviceTests", "{EA9AC363-45BC-4959-BD17-FE3A1B724529}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Caboodle.DeviceTests.Shared", "DeviceTests\Caboodle.DeviceTests.Shared\Caboodle.DeviceTests.Shared.shproj", "{BE0DE9A3-D92C-47C5-9EC4-DFB546BBDF77}"
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "DeviceTests.Shared", "DeviceTests\DeviceTests.Shared\DeviceTests.Shared.shproj", "{BE0DE9A3-D92C-47C5-9EC4-DFB546BBDF77}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caboodle.DeviceTests.Android", "DeviceTests\Caboodle.DeviceTests.Android\Caboodle.DeviceTests.Android.csproj", "{CB2072E0-A437-4811-AE17-16CAE0DDA1B1}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceTests.Android", "DeviceTests\DeviceTests.Android\DeviceTests.Android.csproj", "{CB2072E0-A437-4811-AE17-16CAE0DDA1B1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caboodle.DeviceTests.iOS", "DeviceTests\Caboodle.DeviceTests.iOS\Caboodle.DeviceTests.iOS.csproj", "{EE8FC716-27FC-405B-BD27-AF17E01A6671}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceTests.iOS", "DeviceTests\DeviceTests.iOS\DeviceTests.iOS.csproj", "{EE8FC716-27FC-405B-BD27-AF17E01A6671}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caboodle.DeviceTests.UWP", "DeviceTests\Caboodle.DeviceTests.UWP\Caboodle.DeviceTests.UWP.csproj", "{4BD0D88F-7E7A-4C3B-9E34-BF3717A8FF4B}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceTests.UWP", "DeviceTests\DeviceTests.UWP\DeviceTests.UWP.csproj", "{4BD0D88F-7E7A-4C3B-9E34-BF3717A8FF4B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
DeviceTests\Caboodle.DeviceTests.Shared\Caboodle.DeviceTests.Shared.projitems*{4bd0d88f-7e7a-4c3b-9e34-bf3717a8ff4b}*SharedItemsImports = 4
|
||||
DeviceTests\Caboodle.DeviceTests.Shared\Caboodle.DeviceTests.Shared.projitems*{be0de9a3-d92c-47c5-9ec4-dfb546bbdf77}*SharedItemsImports = 13
|
||||
DeviceTests\Caboodle.DeviceTests.Shared\Caboodle.DeviceTests.Shared.projitems*{cb2072e0-a437-4811-ae17-16cae0dda1b1}*SharedItemsImports = 4
|
||||
DeviceTests\Caboodle.DeviceTests.Shared\Caboodle.DeviceTests.Shared.projitems*{ee8fc716-27fc-405b-bd27-af17e01a6671}*SharedItemsImports = 4
|
||||
DeviceTests\DeviceTests.Shared\DeviceTests.Shared.projitems*{4bd0d88f-7e7a-4c3b-9e34-bf3717a8ff4b}*SharedItemsImports = 4
|
||||
DeviceTests\DeviceTests.Shared\DeviceTests.Shared.projitems*{be0de9a3-d92c-47c5-9ec4-dfb546bbdf77}*SharedItemsImports = 13
|
||||
DeviceTests\DeviceTests.Shared\DeviceTests.Shared.projitems*{cb2072e0-a437-4811-ae17-16cae0dda1b1}*SharedItemsImports = 4
|
||||
DeviceTests\DeviceTests.Shared\DeviceTests.Shared.projitems*{ee8fc716-27fc-405b-bd27-af17e01a6671}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
using Android.Content.Res;
|
||||
using Android.OS;
|
||||
using Android.Provider;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using CaboodlePlatform = Microsoft.Caboodle.Platform;
|
||||
|
||||
namespace Microsoft.Caboodle
|
||||
{
|
||||
public static partial class AppInfo
|
||||
{
|
||||
static string GetPackageName() => CaboodlePlatform.CurrentContext.PackageName;
|
||||
|
||||
static string GetName()
|
||||
{
|
||||
var applicationInfo = CaboodlePlatform.CurrentContext.ApplicationInfo;
|
||||
var packageManager = CaboodlePlatform.CurrentContext.PackageManager;
|
||||
return applicationInfo.LoadLabel(packageManager);
|
||||
}
|
||||
|
||||
static string GetVersionString()
|
||||
{
|
||||
var pm = CaboodlePlatform.CurrentContext.PackageManager;
|
||||
var packageName = CaboodlePlatform.CurrentContext.PackageName;
|
||||
using (var info = pm.GetPackageInfo(packageName, PackageInfoFlags.MetaData))
|
||||
{
|
||||
return info.VersionName;
|
||||
}
|
||||
}
|
||||
|
||||
static string GetBuild()
|
||||
{
|
||||
var pm = CaboodlePlatform.CurrentContext.PackageManager;
|
||||
var packageName = CaboodlePlatform.CurrentContext.PackageName;
|
||||
using (var info = pm.GetPackageInfo(packageName, PackageInfoFlags.MetaData))
|
||||
{
|
||||
return info.VersionCode.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("Caboodle.Tests")]
|
||||
[assembly: InternalsVisibleTo("Caboodle.DeviceTests.Android")]
|
||||
[assembly: InternalsVisibleTo("Caboodle.DeviceTests.UWP")]
|
||||
[assembly: InternalsVisibleTo("CaboodleDeviceTestsiOS")]
|
||||
[assembly: InternalsVisibleTo("Tests")]
|
||||
[assembly: InternalsVisibleTo("DeviceTests.Android")]
|
||||
[assembly: InternalsVisibleTo("DeviceTests.UWP")]
|
||||
[assembly: InternalsVisibleTo("Xamarin.EssentialsDeviceTestsiOS")]
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<namespaces>
|
||||
<namespace name="Microsoft.Caboodle">Caboodle offers a cross-patform APIs for platform specific features.</namespace>
|
||||
</namespaces>
|
|
@ -2,7 +2,7 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Caboodle.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Xamarin.Essentials.ruleset</CodeAnalysisRuleSet>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<ProjectGuid>{CB2072E0-A437-4811-AE17-16CAE0DDA1B1}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Caboodle.DeviceTests.Droid</RootNamespace>
|
||||
<AssemblyName>Caboodle.DeviceTests.Android</AssemblyName>
|
||||
<RootNamespace>DeviceTests.Droid</RootNamespace>
|
||||
<AssemblyName>DeviceTests.Android</AssemblyName>
|
||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
|
@ -65,9 +65,9 @@
|
|||
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Caboodle\Caboodle.csproj">
|
||||
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj">
|
||||
<Project>{63a4f6a1-48bf-4d32-aed7-82f605edb042}</Project>
|
||||
<Name>Caboodle</Name>
|
||||
<Name>Xamarin.Essentials</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -96,6 +96,6 @@
|
|||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\Caboodle.DeviceTests.Shared\Caboodle.DeviceTests.Shared.projitems" Label="Shared" />
|
||||
<Import Project="..\DeviceTests.Shared\DeviceTests.Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
|
@ -8,14 +8,14 @@ using Android.Runtime;
|
|||
using UnitTests.HeadlessRunner;
|
||||
using Xunit.Runners.UI;
|
||||
|
||||
namespace Caboodle.DeviceTests.Droid
|
||||
namespace DeviceTests.Droid
|
||||
{
|
||||
[Activity(Name="com.xamarin.caboodle.devicetests.MainActivity", Label = "@string/app_name", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
[Activity(Name="com.xamarin.DeviceTests.MainActivity", Label = "@string/app_name", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : RunnerActivity
|
||||
{
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
{
|
||||
Microsoft.Caboodle.Platform.Init(this, bundle);
|
||||
Xamarin.Essentials.Platform.Init(this, bundle);
|
||||
|
||||
var hostIp = Intent.Extras?.GetString("HOST_IP", null);
|
||||
var hostPort = Intent.Extras?.GetInt("HOST_PORT", 10578) ?? 10578;
|
||||
|
@ -59,7 +59,7 @@ namespace Caboodle.DeviceTests.Droid
|
|||
|
||||
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
|
||||
{
|
||||
Microsoft.Caboodle.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.1.0" package="com.xamarin.caboodle.devicetests" android:installLocation="auto">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.1.0" package="com.xamarin.DeviceTests" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="26" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.BATTERY_STATS" />
|
||||
|
|
|
@ -6,11 +6,11 @@ using Android.App;
|
|||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Caboodle.DeviceTests.Android")]
|
||||
[assembly: AssemblyTitle("DeviceTests.Android")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Caboodle.DeviceTests.Android")]
|
||||
[assembly: AssemblyProduct("DeviceTests.Android")]
|
||||
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
[assembly: global::Android.Runtime.ResourceDesignerAttribute("Caboodle.DeviceTests.Droid.Resource", IsApplication=true)]
|
||||
[assembly: global::Android.Runtime.ResourceDesignerAttribute("DeviceTests.Droid.Resource", IsApplication=true)]
|
||||
|
||||
namespace Caboodle.DeviceTests.Droid
|
||||
namespace DeviceTests.Droid
|
||||
{
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace Caboodle.DeviceTests.Droid
|
|||
|
||||
public static void UpdateIdValues()
|
||||
{
|
||||
global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::Caboodle.DeviceTests.Droid.Resource.Attribute.actionBarSize;
|
||||
global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::DeviceTests.Droid.Resource.Attribute.actionBarSize;
|
||||
}
|
||||
|
||||
public partial class Animation
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Caboodle Tests</string>
|
||||
<string name="app_name">Tests</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Accelerometer_Tests
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Battery_Tests
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<SharedGUID>{BE0DE9A3-D92C-47C5-9EC4-DFB546BBDF77}</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>Caboodle.DeviceTests</Import_RootNamespace>
|
||||
<Import_RootNamespace>DeviceTests</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Gyroscope_Tests.cs" />
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<Import Project="Caboodle.DeviceTests.Shared.projitems" Label="Shared" />
|
||||
<Import Project="DeviceTests.Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,8 +1,8 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Clipboard_Tests
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Compass_Tests
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Linq;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Connectivity_Tests
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class DeviceInfo_Tests
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ namespace Caboodle.DeviceTests
|
|||
[Fact]
|
||||
public void AppName_Is_Correct()
|
||||
{
|
||||
Assert.Equal("Caboodle Tests", AppInfo.Name);
|
||||
Assert.Equal("Tests", AppInfo.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -31,9 +31,9 @@ namespace Caboodle.DeviceTests
|
|||
#if WINDOWS_UWP
|
||||
Assert.Equal("ec0cc741-fd3e-485c-81be-68815c480690", AppInfo.PackageName);
|
||||
#elif __IOS__
|
||||
Assert.Equal("com.xamarin.caboodle.devicetests", AppInfo.PackageName);
|
||||
Assert.Equal("com.xamarin.DeviceTests", AppInfo.PackageName);
|
||||
#elif __ANDROID__
|
||||
Assert.Equal("com.xamarin.caboodle.devicetests", AppInfo.PackageName);
|
||||
Assert.Equal("com.xamarin.DeviceTests", AppInfo.PackageName);
|
||||
#else
|
||||
throw new PlatformNotSupportedException();
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Email_Tests
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class FileSystem_Tests
|
||||
{
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Flashlight_Tests
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Geocoding_Tests
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Gyroscope_Tests
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Magnetometer_Tests
|
||||
{
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
#if __ANDROID__
|
||||
[assembly: Android.App.UsesPermission(Android.Manifest.Permission.BatteryStats)]
|
||||
#endif
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Permissions_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class PhoneDialer_Tests
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Preferences_Tests
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class ScreenLock_Tests
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class SecureStorage_Tests
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Caboodle;
|
||||
using RuntimeDeviceType = Microsoft.Caboodle.DeviceType;
|
||||
using Xamarin.Essentials;
|
||||
using RuntimeDeviceType = Xamarin.Essentials.DeviceType;
|
||||
using XUnitFilter = UnitTests.HeadlessRunner.Xunit.XUnitFilter;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
internal static class Traits
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Utils
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using Microsoft.Caboodle;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Caboodle.DeviceTests
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Vibration_Tests
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<ui:RunnerApplication
|
||||
x:Class="Caboodle.DeviceTests.UWP.App"
|
||||
x:Class="DeviceTests.UWP.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Caboodle.DeviceTests.UWP"
|
||||
xmlns:local="using:DeviceTests.UWP"
|
||||
xmlns:ui="using:Xunit.Runners.UI"
|
||||
RequestedTheme="Light">
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ using Windows.UI.Xaml;
|
|||
using Windows.UI.Xaml.Controls;
|
||||
using Xunit.Runners.UI;
|
||||
|
||||
namespace Caboodle.DeviceTests.UWP
|
||||
namespace DeviceTests.UWP
|
||||
{
|
||||
public sealed partial class App : RunnerApplication
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<ProjectGuid>{4BD0D88F-7E7A-4C3B-9E34-BF3717A8FF4B}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Caboodle.DeviceTests.UWP</RootNamespace>
|
||||
<AssemblyName>Caboodle.DeviceTests.UWP</AssemblyName>
|
||||
<RootNamespace>DeviceTests.UWP</RootNamespace>
|
||||
<AssemblyName>DeviceTests.UWP</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PackageCertificateKeyFile>Caboodle.DeviceTests.UWP_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
<PackageCertificateKeyFile>DeviceTests.UWP_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
<PackageCertificateThumbprint>167A368DF44D3492E081E0A0317B51A870E26E61</PackageCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
|
@ -104,9 +104,9 @@
|
|||
</SDKReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Caboodle\Caboodle.csproj">
|
||||
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj">
|
||||
<Project>{63a4f6a1-48bf-4d32-aed7-82f605edb042}</Project>
|
||||
<Name>Caboodle</Name>
|
||||
<Name>Xamarin.Essentials</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -164,12 +164,12 @@
|
|||
<Content Include="Assets\Wide310x150Logo.scale-400.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Caboodle.DeviceTests.UWP_TemporaryKey.pfx" />
|
||||
<None Include="DeviceTests.UWP_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\Caboodle.DeviceTests.Shared\Caboodle.DeviceTests.Shared.projitems" Label="Shared" />
|
||||
<Import Project="..\DeviceTests.Shared\DeviceTests.Shared.projitems" Label="Shared" />
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<Identity Name="ec0cc741-fd3e-485c-81be-68815c480690" Publisher="CN=Xamarin Inc." Version="1.0.1.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="ec0cc741-fd3e-485c-81be-68815c480690" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>Caboodle Tests</DisplayName>
|
||||
<DisplayName>Tests</DisplayName>
|
||||
<PublisherDisplayName>Xamarin Inc.</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
@ -14,16 +14,16 @@
|
|||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Caboodle.DeviceTests.UWP.App">
|
||||
<uap:VisualElements DisplayName="Caboodle Tests" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Microsoft Caboodle Tests" BackgroundColor="transparent">
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="DeviceTests.UWP.App">
|
||||
<uap:VisualElements DisplayName="Tests" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Tests" BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
|
||||
</uap:DefaultTile>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
<Extensions>
|
||||
<uap:Extension Category="windows.protocol">
|
||||
<uap:Protocol Name="caboodle-device-tests">
|
||||
<uap:DisplayName>Caboodle Device Tests</uap:DisplayName>
|
||||
<uap:Protocol Name="Xamarin.Essentials-device-tests">
|
||||
<uap:DisplayName>Xamarin.Essentials Device Tests</uap:DisplayName>
|
||||
</uap:Protocol>
|
||||
</uap:Extension>
|
||||
</Extensions>
|
||||
|
|
|
@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
|
|||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Caboodle.DeviceTests.UWP")]
|
||||
[assembly: AssemblyTitle("DeviceTests.UWP")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Caboodle.DeviceTests.UWP")]
|
||||
[assembly: AssemblyProduct("DeviceTests.UWP")]
|
||||
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
|
|
@ -5,7 +5,7 @@ using Foundation;
|
|||
using UIKit;
|
||||
using UnitTests.HeadlessRunner;
|
||||
|
||||
namespace Caboodle.DeviceTests.iOS
|
||||
namespace DeviceTests.iOS
|
||||
{
|
||||
[Register(nameof(AppDelegate))]
|
||||
public partial class AppDelegate : Xunit.Runner.RunnerAppDelegate
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
<ProjectGuid>{EE8FC716-27FC-405B-BD27-AF17E01A6671}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Caboodle.DeviceTests.iOS</RootNamespace>
|
||||
<RootNamespace>DeviceTests.iOS</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>CaboodleDeviceTestsiOS</AssemblyName>
|
||||
<AssemblyName>Xamarin.EssentialsDeviceTestsiOS</AssemblyName>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
|
@ -78,9 +78,9 @@
|
|||
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Caboodle\Caboodle.csproj">
|
||||
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj">
|
||||
<Project>{63a4f6a1-48bf-4d32-aed7-82f605edb042}</Project>
|
||||
<Name>Caboodle</Name>
|
||||
<Name>Xamarin.Essentials</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -119,5 +119,5 @@
|
|||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<Import Project="..\Caboodle.DeviceTests.Shared\Caboodle.DeviceTests.Shared.projitems" Label="Shared" />
|
||||
<Import Project="..\DeviceTests.Shared\DeviceTests.Shared.projitems" Label="Shared" />
|
||||
</Project>
|
|
@ -3,4 +3,4 @@
|
|||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "iOS is what we want.", Scope = "namespace", Target = "~N:Caboodle.DeviceTests.iOS")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "iOS is what we want.", Scope = "namespace", Target = "~N:DeviceTests.iOS")]
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
<key>MinimumOSVersion</key>
|
||||
<string>10.0</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Caboodle Tests</string>
|
||||
<string>Tests</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.caboodle.devicetests</string>
|
||||
<string>com.xamarin.DeviceTests</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>CFBundleIconFiles</key>
|
||||
|
@ -50,7 +50,7 @@
|
|||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Caboodle.DeviceTests</string>
|
||||
<string>DeviceTests</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.1.0</string>
|
||||
</dict>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using UIKit;
|
||||
|
||||
namespace Caboodle.DeviceTests.iOS
|
||||
namespace DeviceTests.iOS
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
|
|
|
@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
|
|||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Caboodle.DeviceTests.iOS")]
|
||||
[assembly: AssemblyTitle("DeviceTests.iOS")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Caboodle.DeviceTests.iOS")]
|
||||
[assembly: AssemblyProduct("DeviceTests.iOS")]
|
||||
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{CB2072E0-A437-4811-AE17-16CAE0DDA1B1}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>DeviceTests.Droid</RootNamespace>
|
||||
<AssemblyName>DeviceTests.Android</AssemblyName>
|
||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<AndroidSupportedAbis />
|
||||
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
|
||||
<AndroidLinkSkip />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="2.5.0.280555" />
|
||||
<PackageReference Include="Xamarin.Android.Support.Design" Version="26.1.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="26.1.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v4" Version="26.1.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="26.1.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="26.1.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="26.1.0.1" />
|
||||
<PackageReference Include="xunit" Version="2.3.1" />
|
||||
<PackageReference Include="xunit.runner.devices" Version="2.3.3" />
|
||||
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj">
|
||||
<Project>{63a4f6a1-48bf-4d32-aed7-82f605edb042}</Project>
|
||||
<Name>Xamarin.Essentials</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.Designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\icon.png" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\icon.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\icon.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\icon.png" />
|
||||
<AndroidResource Include="Resources\layout\Tabbar.axml" />
|
||||
<AndroidResource Include="Resources\layout\Toolbar.axml" />
|
||||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
<AndroidResource Include="Resources\values\strings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidAsset Include="Assets\AppBundleFile.txt" />
|
||||
<AndroidAsset Include="Assets\AppBundleFile_NoExtension" />
|
||||
<AndroidAsset Include="Assets\Folder\AppBundleFile_Nested.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\DeviceTests.Shared\DeviceTests.Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,67 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.OS;
|
||||
using Android.Runtime;
|
||||
using UnitTests.HeadlessRunner;
|
||||
using Xunit.Runners.UI;
|
||||
|
||||
namespace DeviceTests.Droid
|
||||
{
|
||||
[Activity(Name="com.xamarin.DeviceTests.MainActivity", Label = "@string/app_name", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : RunnerActivity
|
||||
{
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
{
|
||||
Xamarin.Essentials.Platform.Init(this, bundle);
|
||||
|
||||
var hostIp = Intent.Extras?.GetString("HOST_IP", null);
|
||||
var hostPort = Intent.Extras?.GetInt("HOST_PORT", 10578) ?? 10578;
|
||||
|
||||
if (!string.IsNullOrEmpty(hostIp))
|
||||
{
|
||||
// Run the headless test runner for CI
|
||||
Task.Run(() =>
|
||||
{
|
||||
return Tests.RunAsync(new TestOptions
|
||||
{
|
||||
Assemblies = new List<Assembly> { typeof(Battery_Tests).Assembly },
|
||||
NetworkLogHost = hostIp,
|
||||
NetworkLogPort = hostPort,
|
||||
Filters = Traits.GetCommonTraits(),
|
||||
Format = TestResultsFormat.XunitV2
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// tests can be inside the main assembly
|
||||
AddTestAssembly(Assembly.GetExecutingAssembly());
|
||||
AddExecutionAssembly(typeof(Battery_Tests).Assembly);
|
||||
|
||||
// or in any reference assemblies
|
||||
// AddTestAssembly(typeof(PortableTests).Assembly);
|
||||
// or in any assembly that you load (since JIT is available)
|
||||
|
||||
#if false
|
||||
// you can use the default or set your own custom writer (e.g. save to web site and tweet it ;-)
|
||||
Writer = new TcpTextWriter("10.0.1.2", 16384);
|
||||
// start running the test suites as soon as the application is loaded
|
||||
AutoStart = true;
|
||||
// crash the application (to ensure it's ended) and return to springboard
|
||||
TerminateAfterExecution = true;
|
||||
#endif
|
||||
|
||||
// you cannot add more assemblies once calling base
|
||||
base.OnCreate(bundle);
|
||||
}
|
||||
|
||||
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
|
||||
{
|
||||
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.1.0" package="com.xamarin.essentials.devicetests" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="26" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.BATTERY_STATS" />
|
||||
<application android:label="@string/app_name" android:icon="@drawable/icon" android:theme="@style/MainTheme"></application>
|
||||
</manifest>
|
|
@ -0,0 +1,34 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DeviceTests.Android")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DeviceTests.Android")]
|
||||
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
// Add some common permissions, these can be removed if not needed
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
|
До Ширина: | Высота: | Размер: 1.4 KiB После Ширина: | Высота: | Размер: 1.4 KiB |
До Ширина: | Высота: | Размер: 1.7 KiB После Ширина: | Высота: | Размер: 1.7 KiB |
До Ширина: | Высота: | Размер: 2.3 KiB После Ширина: | Высота: | Размер: 2.3 KiB |
До Ширина: | Высота: | Размер: 1.4 KiB После Ширина: | Высота: | Размер: 1.4 KiB |
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Tests</string>
|
||||
</resources>
|
|
@ -0,0 +1,105 @@
|
|||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Accelerometer_Tests
|
||||
{
|
||||
bool TestSupported =>
|
||||
DeviceInfo.Platform == DeviceInfo.Platforms.Android ||
|
||||
(DeviceInfo.DeviceType == DeviceType.Physical && DeviceInfo.Platform == DeviceInfo.Platforms.iOS);
|
||||
|
||||
public Accelerometer_Tests()
|
||||
{
|
||||
Accelerometer.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsSupported()
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
Assert.False(Accelerometer.IsSupported);
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.True(Accelerometer.IsSupported);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task Monitor(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<AccelerometerData>();
|
||||
Accelerometer.ReadingChanged += Accelerometer_ReadingChanged;
|
||||
Accelerometer.Start(sensorSpeed);
|
||||
|
||||
void Accelerometer_ReadingChanged(AccelerometerChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
|
||||
var d = await tcs.Task;
|
||||
|
||||
Accelerometer.Stop();
|
||||
Accelerometer.ReadingChanged -= Accelerometer_ReadingChanged;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task IsMonitoring(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<AccelerometerData>();
|
||||
Accelerometer.ReadingChanged += Accelerometer_ReadingChanged;
|
||||
Accelerometer.Start(sensorSpeed);
|
||||
|
||||
void Accelerometer_ReadingChanged(AccelerometerChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
|
||||
var d = await tcs.Task;
|
||||
Assert.True(Accelerometer.IsMonitoring);
|
||||
Accelerometer.Stop();
|
||||
Accelerometer.ReadingChanged -= Accelerometer_ReadingChanged;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task Stop_Monitor(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<AccelerometerData>();
|
||||
|
||||
Accelerometer.ReadingChanged += Accelerometer_ReadingChanged;
|
||||
Accelerometer.Start(sensorSpeed);
|
||||
|
||||
void Accelerometer_ReadingChanged(AccelerometerChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
|
||||
var d = await tcs.Task;
|
||||
|
||||
Accelerometer.Stop();
|
||||
Accelerometer.ReadingChanged -= Accelerometer_ReadingChanged;
|
||||
|
||||
Assert.False(Accelerometer.IsMonitoring);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Battery_Tests
|
||||
{
|
||||
[Fact]
|
||||
[Trait(Traits.DeviceType, Traits.DeviceTypes.Physical)]
|
||||
public void Charge_Level()
|
||||
{
|
||||
// TODO: remove this as soon as the test harness can filter
|
||||
// the iOS simulator does not emulate a battery
|
||||
if (DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DeviceInfo.Platforms.iOS)
|
||||
return;
|
||||
|
||||
Assert.InRange(Battery.ChargeLevel, 0.01, 100.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait(Traits.DeviceType, Traits.DeviceTypes.Physical)]
|
||||
public void Charge_State()
|
||||
{
|
||||
// TODO: remove this as soon as the test harness can filter
|
||||
// the iOS simulator does not emulate a battery
|
||||
if (DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DeviceInfo.Platforms.iOS)
|
||||
return;
|
||||
|
||||
Assert.NotEqual(BatteryState.Unknown, Battery.State);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait(Traits.DeviceType, Traits.DeviceTypes.Physical)]
|
||||
public void Charge_Power()
|
||||
{
|
||||
// TODO: remove this as soon as the test harness can filter
|
||||
// the iOS simulator does not emulate a battery
|
||||
if (DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DeviceInfo.Platforms.iOS)
|
||||
return;
|
||||
|
||||
Assert.NotEqual(BatteryPowerSource.Unknown, Battery.PowerSource);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Clipboard_Tests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("text")]
|
||||
[InlineData("some really long test text")]
|
||||
public Task Set_Clipboard_Values(string text)
|
||||
{
|
||||
return Utils.OnMainThread(async () =>
|
||||
{
|
||||
Clipboard.SetText(text);
|
||||
|
||||
await Task.Delay(100);
|
||||
|
||||
Assert.True(Clipboard.HasText);
|
||||
});
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("text")]
|
||||
[InlineData("some really long test text")]
|
||||
public Task Get_Clipboard_Values(string text)
|
||||
{
|
||||
return Utils.OnMainThread(async () =>
|
||||
{
|
||||
Clipboard.SetText(text);
|
||||
var clipText = await Clipboard.GetTextAsync();
|
||||
|
||||
Assert.NotNull(clipText);
|
||||
Assert.Equal(text, clipText);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Compass_Tests
|
||||
{
|
||||
bool TestSupported =>
|
||||
DeviceInfo.Platform == DeviceInfo.Platforms.Android ||
|
||||
DeviceInfo.Platform == DeviceInfo.Platforms.UWP ||
|
||||
(DeviceInfo.DeviceType == DeviceType.Physical && DeviceInfo.Platform == DeviceInfo.Platforms.iOS);
|
||||
|
||||
public Compass_Tests()
|
||||
{
|
||||
Compass.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsSupported()
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
Assert.False(Compass.IsSupported);
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.True(Compass.IsSupported);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task Monitor(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<CompassData>();
|
||||
|
||||
Compass.ReadingChanged += Compass_ReadingChanged;
|
||||
void Compass_ReadingChanged(CompassChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
Compass.Start(sensorSpeed);
|
||||
|
||||
var d = await tcs.Task;
|
||||
|
||||
Assert.True(d.HeadingMagneticNorth >= 0);
|
||||
Compass.Stop();
|
||||
Compass.ReadingChanged -= Compass_ReadingChanged;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task IsMonitoring(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<CompassData>();
|
||||
Compass.ReadingChanged += Compass_ReadingChanged;
|
||||
void Compass_ReadingChanged(CompassChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
Compass.Start(sensorSpeed);
|
||||
|
||||
var d = await tcs.Task;
|
||||
Assert.True(Compass.IsMonitoring);
|
||||
|
||||
Compass.Stop();
|
||||
Compass.ReadingChanged -= Compass_ReadingChanged;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task Stop_Monitor(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<CompassData>();
|
||||
Compass.ReadingChanged += Compass_ReadingChanged;
|
||||
void Compass_ReadingChanged(CompassChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
Compass.Start(sensorSpeed);
|
||||
|
||||
var d = await tcs.Task;
|
||||
|
||||
Compass.Stop();
|
||||
Compass.ReadingChanged -= Compass_ReadingChanged;
|
||||
|
||||
Assert.False(Compass.IsMonitoring);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
using System.Linq;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Connectivity_Tests
|
||||
{
|
||||
[Fact]
|
||||
public void Network_Access() =>
|
||||
Assert.Equal(NetworkAccess.Internet, Connectivity.NetworkAccess);
|
||||
|
||||
[Fact]
|
||||
public void Profiles() =>
|
||||
Assert.True(Connectivity.Profiles.Count() > 0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class DeviceInfo_Tests
|
||||
{
|
||||
[Fact]
|
||||
public void Versions_Are_Correct()
|
||||
{
|
||||
#if WINDOWS_UWP
|
||||
Assert.Equal(10, DeviceInfo.Version.Major);
|
||||
Assert.Equal(0, DeviceInfo.Version.Minor);
|
||||
Assert.StartsWith("10.0", DeviceInfo.VersionString);
|
||||
#else
|
||||
Assert.True(DeviceInfo.Version.Major > 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AppName_Is_Correct()
|
||||
{
|
||||
Assert.Equal("Tests", AppInfo.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AppPackageName_Is_Correct()
|
||||
{
|
||||
#if WINDOWS_UWP
|
||||
Assert.Equal("ec0cc741-fd3e-485c-81be-68815c480690", AppInfo.PackageName);
|
||||
#elif __IOS__
|
||||
Assert.Equal("com.xamarin.DeviceTests", AppInfo.PackageName);
|
||||
#elif __ANDROID__
|
||||
Assert.Equal("com.xamarin.DeviceTests", AppInfo.PackageName);
|
||||
#else
|
||||
throw new PlatformNotSupportedException();
|
||||
#endif
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Platform_Is_Correct()
|
||||
{
|
||||
#if WINDOWS_UWP
|
||||
Assert.Equal(DeviceInfo.Platforms.UWP, DeviceInfo.Platform);
|
||||
#elif __IOS__
|
||||
Assert.Equal(DeviceInfo.Platforms.iOS, DeviceInfo.Platform);
|
||||
#elif __ANDROID__
|
||||
Assert.Equal(DeviceInfo.Platforms.Android, DeviceInfo.Platform);
|
||||
#else
|
||||
throw new PlatformNotSupportedException();
|
||||
#endif
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void App_Build_Is_Correct()
|
||||
{
|
||||
Assert.Equal("1", AppInfo.BuildString);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void App_Versions_Are_Correct()
|
||||
{
|
||||
Assert.Equal("1.0.1.0", AppInfo.VersionString);
|
||||
Assert.Equal(new Version(1, 0, 1, 0), AppInfo.Version);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task Screen_Metrics_Are_Not_Null()
|
||||
{
|
||||
return Utils.OnMainThread(() =>
|
||||
{
|
||||
var metrics = DeviceInfo.ScreenMetrics;
|
||||
|
||||
Assert.True(metrics.Width > 0);
|
||||
Assert.True(metrics.Height > 0);
|
||||
Assert.True(metrics.Density > 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<SharedGUID>{BE0DE9A3-D92C-47C5-9EC4-DFB546BBDF77}</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>DeviceTests</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Gyroscope_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Accelerometer_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Magnetometer_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Compass_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Connectivity_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Email_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Battery_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Clipboard_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DeviceInfo_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Flashlight_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Geocoding_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Permissions_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)PhoneDialer_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ScreenLock_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Preferences_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)FileSystem_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)SecureStorage_Tests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Traits.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Utils.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\CodeStyles.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{BE0DE9A3-D92C-47C5-9EC4-DFB546BBDF77}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<Import Project="DeviceTests.Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Email_Tests
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class FileSystem_Tests
|
||||
{
|
||||
private const string bundleFileContents = "This file was in the app bundle.";
|
||||
|
||||
[Fact]
|
||||
public void CacheDirectory_Is_Valid()
|
||||
{
|
||||
Assert.False(string.IsNullOrWhiteSpace(FileSystem.CacheDirectory));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AppDataDirectory_Is_Valid()
|
||||
{
|
||||
Assert.False(string.IsNullOrWhiteSpace(FileSystem.AppDataDirectory));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("AppBundleFile.txt", bundleFileContents)]
|
||||
[InlineData("AppBundleFile_NoExtension", bundleFileContents)]
|
||||
[InlineData("Folder/AppBundleFile_Nested.txt", bundleFileContents)]
|
||||
[InlineData("Folder\\AppBundleFile_Nested.txt", bundleFileContents)]
|
||||
public async Task OpenAppPackageFileAsync_Can_Load_File(string filename, string contents)
|
||||
{
|
||||
using (var stream = await FileSystem.OpenAppPackageFileAsync(filename))
|
||||
{
|
||||
Assert.NotNull(stream);
|
||||
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
var text = await reader.ReadToEndAsync();
|
||||
|
||||
Assert.Equal(contents, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task OpenAppPackageFileAsync_Throws_If_File_Is_Not_Found()
|
||||
{
|
||||
await Assert.ThrowsAsync<FileNotFoundException>(() => FileSystem.OpenAppPackageFileAsync("MissingFile.txt"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Flashlight_Tests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public async Task Turn_On_Off(bool oldCameraApi)
|
||||
{
|
||||
if (DeviceInfo.Platform == DeviceInfo.Platforms.UWP)
|
||||
{
|
||||
await Utils.OnMainThread(async () =>
|
||||
{
|
||||
await Assert.ThrowsAsync<FeatureNotSupportedException>(() => Flashlight.TurnOnAsync());
|
||||
});
|
||||
return;
|
||||
}
|
||||
#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;
|
||||
|
||||
Flashlight.AlwaysUseCameraApi = oldCameraApi;
|
||||
#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 == DeviceInfo.Platforms.iOS)
|
||||
return;
|
||||
#endif
|
||||
await Flashlight.TurnOnAsync();
|
||||
await Flashlight.TurnOffAsync();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Geocoding_Tests
|
||||
{
|
||||
public Geocoding_Tests()
|
||||
{
|
||||
Geocoding.MapKey = "RJHqIE53Onrqons5CNOx~FrDr3XhjDTyEXEjng-CRoA~Aj69MhNManYUKxo6QcwZ0wmXBtyva0zwuHB04rFYAPf7qqGJ5cHb03RCDw1jIW8l";
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(47.673988, -122.121513)]
|
||||
public async Task Get_Placemarks_LatLong(double latitude, double longitude)
|
||||
{
|
||||
var placemarks = await Geocoding.GetPlacemarksAsync(latitude, longitude);
|
||||
|
||||
Assert.NotNull(placemarks);
|
||||
Assert.True(placemarks.Any());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(47.673988, -122.121513)]
|
||||
public async Task Get_Placemarks_Location(double latitude, double longitude)
|
||||
{
|
||||
var placemarks = await Geocoding.GetPlacemarksAsync(new Location(latitude, longitude));
|
||||
|
||||
Assert.NotNull(placemarks);
|
||||
Assert.True(placemarks.Any());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Microsoft Building 25 Redmond WA USA")]
|
||||
public async Task Get_Locations(string address)
|
||||
{
|
||||
var locations = await Geocoding.GetLocationsAsync(address);
|
||||
|
||||
Assert.NotNull(locations);
|
||||
Assert.True(locations.Any());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Gyroscope_Tests
|
||||
{
|
||||
bool TestSupported =>
|
||||
(DeviceInfo.DeviceType == DeviceType.Physical && DeviceInfo.Platform == DeviceInfo.Platforms.Android) ||
|
||||
(DeviceInfo.DeviceType == DeviceType.Physical && DeviceInfo.Platform == DeviceInfo.Platforms.iOS);
|
||||
|
||||
public Gyroscope_Tests()
|
||||
{
|
||||
Gyroscope.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsSupported()
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
Assert.False(Gyroscope.IsSupported);
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.True(Gyroscope.IsSupported);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task Monitor(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<GyroscopeData>();
|
||||
Gyroscope.ReadingChanged += Gyroscope_ReadingChanged;
|
||||
Gyroscope.Start(sensorSpeed);
|
||||
|
||||
void Gyroscope_ReadingChanged(GyroscopeChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
|
||||
var d = await tcs.Task;
|
||||
|
||||
Gyroscope.Stop();
|
||||
Gyroscope.ReadingChanged -= Gyroscope_ReadingChanged;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task IsMonitoring(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<GyroscopeData>();
|
||||
Gyroscope.ReadingChanged += Gyroscope_ReadingChanged;
|
||||
Gyroscope.Start(sensorSpeed);
|
||||
|
||||
void Gyroscope_ReadingChanged(GyroscopeChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
|
||||
var d = await tcs.Task;
|
||||
Assert.True(Gyroscope.IsMonitoring);
|
||||
Gyroscope.Stop();
|
||||
Gyroscope.ReadingChanged -= Gyroscope_ReadingChanged;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task Stop_Monitor(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<GyroscopeData>();
|
||||
|
||||
Gyroscope.ReadingChanged += Gyroscope_ReadingChanged;
|
||||
Gyroscope.Start(sensorSpeed);
|
||||
|
||||
void Gyroscope_ReadingChanged(GyroscopeChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
|
||||
var d = await tcs.Task;
|
||||
|
||||
Gyroscope.Stop();
|
||||
Gyroscope.ReadingChanged -= Gyroscope_ReadingChanged;
|
||||
|
||||
Assert.False(Gyroscope.IsMonitoring);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Magnetometer_Tests
|
||||
{
|
||||
bool TestSupported =>
|
||||
DeviceInfo.Platform == DeviceInfo.Platforms.Android ||
|
||||
(DeviceInfo.DeviceType == DeviceType.Physical && DeviceInfo.Platform == DeviceInfo.Platforms.iOS);
|
||||
|
||||
public Magnetometer_Tests()
|
||||
{
|
||||
Magnetometer.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsSupported()
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
Assert.False(Magnetometer.IsSupported);
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.True(Magnetometer.IsSupported);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task Monitor(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<MagnetometerData>();
|
||||
Magnetometer.ReadingChanged += Magnetometer_ReadingChanged;
|
||||
Magnetometer.Start(sensorSpeed);
|
||||
|
||||
void Magnetometer_ReadingChanged(MagnetometerChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
|
||||
var d = await tcs.Task;
|
||||
|
||||
Magnetometer.Stop();
|
||||
Magnetometer.ReadingChanged -= Magnetometer_ReadingChanged;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task IsMonitoring(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<MagnetometerData>();
|
||||
Magnetometer.ReadingChanged += Magnetometer_ReadingChanged;
|
||||
Magnetometer.Start(sensorSpeed);
|
||||
|
||||
void Magnetometer_ReadingChanged(MagnetometerChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
|
||||
var d = await tcs.Task;
|
||||
Assert.True(Magnetometer.IsMonitoring);
|
||||
Magnetometer.Stop();
|
||||
Magnetometer.ReadingChanged -= Magnetometer_ReadingChanged;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(SensorSpeed.Fastest)]
|
||||
public async Task Stop_Monitor(SensorSpeed sensorSpeed)
|
||||
{
|
||||
if (!TestSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<MagnetometerData>();
|
||||
|
||||
Magnetometer.ReadingChanged += Magnetometer_ReadingChanged;
|
||||
Magnetometer.Start(sensorSpeed);
|
||||
|
||||
void Magnetometer_ReadingChanged(MagnetometerChangedEventArgs e)
|
||||
{
|
||||
tcs.TrySetResult(e.Reading);
|
||||
}
|
||||
|
||||
var d = await tcs.Task;
|
||||
|
||||
Magnetometer.Stop();
|
||||
Magnetometer.ReadingChanged -= Magnetometer_ReadingChanged;
|
||||
|
||||
Assert.False(Magnetometer.IsMonitoring);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
#if __ANDROID__
|
||||
[assembly: Android.App.UsesPermission(Android.Manifest.Permission.BatteryStats)]
|
||||
#endif
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Permissions_Tests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(PermissionType.Battery)]
|
||||
[InlineData(PermissionType.NetworkState)]
|
||||
internal void Ensure_Declared(PermissionType permission)
|
||||
{
|
||||
Permissions.EnsureDeclared(permission);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(PermissionType.LocationWhenInUse)]
|
||||
internal void Ensure_Declared_Throws(PermissionType permission)
|
||||
{
|
||||
if (DeviceInfo.Platform == DeviceInfo.Platforms.UWP)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.Throws<PermissionException>(() => Permissions.EnsureDeclared(permission));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(PermissionType.Battery, PermissionStatus.Granted)]
|
||||
[InlineData(PermissionType.NetworkState, PermissionStatus.Granted)]
|
||||
internal async Task Check_Status(PermissionType permission, PermissionStatus expectedStatus)
|
||||
{
|
||||
var status = await Permissions.CheckStatusAsync(permission);
|
||||
|
||||
Assert.Equal(expectedStatus, status);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(PermissionType.LocationWhenInUse)]
|
||||
internal Task Check_Status_Throws(PermissionType permission)
|
||||
{
|
||||
if (DeviceInfo.Platform == DeviceInfo.Platforms.UWP)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
return Assert.ThrowsAsync<PermissionException>(async () => await Permissions.CheckStatusAsync(permission));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(PermissionType.Battery, PermissionStatus.Granted)]
|
||||
[InlineData(PermissionType.NetworkState, PermissionStatus.Granted)]
|
||||
internal async Task Request(PermissionType permission, PermissionStatus expectedStatus)
|
||||
{
|
||||
var status = await Permissions.CheckStatusAsync(permission);
|
||||
|
||||
Assert.Equal(expectedStatus, status);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class PhoneDialer_Tests
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class Preferences_Tests
|
||||
{
|
||||
const string sharedNameTestData = "Shared";
|
||||
|
||||
[Theory]
|
||||
[InlineData("string1", "TEST", null)]
|
||||
[InlineData("string1", "TEST", sharedNameTestData)]
|
||||
public void Set_Get_String(string key, string value, string sharedName)
|
||||
{
|
||||
Preferences.Set(key, value, sharedName);
|
||||
|
||||
Assert.Equal(value, Preferences.Get(key, null, sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("string1", "TEST", null)]
|
||||
[InlineData("string1", "TEST", sharedNameTestData)]
|
||||
public void Set_Set_Null_Get_String(string key, string value, string sharedName)
|
||||
{
|
||||
Preferences.Set(key, value, sharedName);
|
||||
Preferences.Set(key, null, sharedName);
|
||||
|
||||
Assert.Null(Preferences.Get(key, null, sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("int1", int.MaxValue - 1, null)]
|
||||
[InlineData("sint1", int.MinValue + 1, null)]
|
||||
[InlineData("int1", int.MaxValue - 1, sharedNameTestData)]
|
||||
[InlineData("sint1", int.MinValue + 1, sharedNameTestData)]
|
||||
public void Set_Get_Int(string key, int value, string sharedName)
|
||||
{
|
||||
Preferences.Set(key, value, sharedName);
|
||||
Assert.Equal(value, Preferences.Get(key, 0, sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("long1", long.MaxValue - 1, null)]
|
||||
[InlineData("slong1", long.MinValue + 1, null)]
|
||||
[InlineData("long1", long.MaxValue - 1, sharedNameTestData)]
|
||||
[InlineData("slong1", long.MinValue + 1, sharedNameTestData)]
|
||||
public void Set_Get_Long(string key, long value, string sharedName)
|
||||
{
|
||||
Preferences.Set(key, value, sharedName);
|
||||
Assert.Equal(value, Preferences.Get(key, 0L, sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("float1", float.MaxValue - 1, null)]
|
||||
[InlineData("sfloat1", float.MinValue + 1, null)]
|
||||
[InlineData("float1", float.MaxValue - 1, sharedNameTestData)]
|
||||
[InlineData("sfloat1", float.MinValue + 1, sharedNameTestData)]
|
||||
public void Set_Get_Float(string key, float value, string sharedName)
|
||||
{
|
||||
Preferences.Set(key, value, sharedName);
|
||||
Assert.Equal(value, Preferences.Get(key, 0f, sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("double1", double.MaxValue - 1, null)]
|
||||
[InlineData("sdouble1", double.MinValue + 1, null)]
|
||||
[InlineData("double1", double.MaxValue - 1, sharedNameTestData)]
|
||||
[InlineData("sdouble1", double.MinValue + 1, sharedNameTestData)]
|
||||
public void Set_Get_Double(string key, double value, string sharedName)
|
||||
{
|
||||
Preferences.Set(key, value, sharedName);
|
||||
Assert.Equal(value, Preferences.Get(key, 0d, sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("bool1", true, null)]
|
||||
[InlineData("bool1", true, sharedNameTestData)]
|
||||
public void Set_Get_Bool(string key, bool value, string sharedName)
|
||||
{
|
||||
Preferences.Set(key, value, sharedName);
|
||||
Assert.Equal(value, Preferences.Get(key, false, sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData(sharedNameTestData)]
|
||||
public void Remove(string sharedName)
|
||||
{
|
||||
Preferences.Set("RemoveKey1", "value", sharedName);
|
||||
|
||||
Assert.Equal("value", Preferences.Get("RemoveKey1", null, sharedName));
|
||||
|
||||
Preferences.Remove("RemoveKey1", sharedName);
|
||||
|
||||
Assert.Null(Preferences.Get("RemoveKey1", null, sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData(sharedNameTestData)]
|
||||
public void Clear(string sharedName)
|
||||
{
|
||||
Preferences.Set("ClearKey1", "value", sharedName);
|
||||
Preferences.Set("ClearKey2", 2, sharedName);
|
||||
|
||||
Assert.Equal(2, Preferences.Get("ClearKey2", 0, sharedName));
|
||||
|
||||
Preferences.Clear(sharedName);
|
||||
|
||||
Assert.NotEqual("value", Preferences.Get("ClearKey1", null, sharedName));
|
||||
Assert.NotEqual(2, Preferences.Get("ClearKey2", 0, sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData(sharedNameTestData)]
|
||||
public void Does_ContainsKey(string sharedName)
|
||||
{
|
||||
Preferences.Set("DoesContainsKey1", "One", sharedName);
|
||||
|
||||
Assert.True(Preferences.ContainsKey("DoesContainsKey1", sharedName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData(sharedNameTestData)]
|
||||
public void Not_ContainsKey(string sharedName)
|
||||
{
|
||||
Preferences.Remove("NotContainsKey1", sharedName);
|
||||
|
||||
Assert.False(Preferences.ContainsKey("NotContainsKey1", sharedName));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class ScreenLock_Tests
|
||||
{
|
||||
[Fact]
|
||||
public Task ScreenLock_Locks()
|
||||
{
|
||||
return Utils.OnMainThread(() =>
|
||||
{
|
||||
Assert.False(ScreenLock.IsActive);
|
||||
|
||||
ScreenLock.RequestActive();
|
||||
Assert.True(ScreenLock.IsActive);
|
||||
|
||||
ScreenLock.RequestRelease();
|
||||
Assert.False(ScreenLock.IsActive);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task ScreenLock_Unlocks_Without_Locking()
|
||||
{
|
||||
return Utils.OnMainThread(() =>
|
||||
{
|
||||
Assert.False(ScreenLock.IsActive);
|
||||
|
||||
ScreenLock.RequestRelease();
|
||||
Assert.False(ScreenLock.IsActive);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task ScreenLock_Locks_Only_Once()
|
||||
{
|
||||
return Utils.OnMainThread(() =>
|
||||
{
|
||||
Assert.False(ScreenLock.IsActive);
|
||||
|
||||
ScreenLock.RequestActive();
|
||||
Assert.True(ScreenLock.IsActive);
|
||||
ScreenLock.RequestActive();
|
||||
Assert.True(ScreenLock.IsActive);
|
||||
|
||||
ScreenLock.RequestRelease();
|
||||
Assert.False(ScreenLock.IsActive);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
public class SecureStorage_Tests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("test.txt", "data", true)]
|
||||
[InlineData("noextension", "data2", true)]
|
||||
[InlineData("funny*&$%@!._/\\chars", "data3", true)]
|
||||
[InlineData("test.txt2", "data2", false)]
|
||||
[InlineData("noextension2", "data22", false)]
|
||||
[InlineData("funny*&$%@!._/\\chars2", "data32", false)]
|
||||
public async Task Saves_And_Loads(string key, string data, bool emulatePreApi23)
|
||||
{
|
||||
#if __ANDROID__
|
||||
SecureStorage.AlwaysUseAsymmetricKeyStorage = emulatePreApi23;
|
||||
#elif __IOS__
|
||||
if (Utils.IsiOSSimulator)
|
||||
return;
|
||||
#endif
|
||||
|
||||
await SecureStorage.SetAsync(key, data);
|
||||
|
||||
var c = await SecureStorage.GetAsync(key);
|
||||
|
||||
Assert.Equal(data, c);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Xamarin.Essentials;
|
||||
using RuntimeDeviceType = Xamarin.Essentials.DeviceType;
|
||||
using XUnitFilter = UnitTests.HeadlessRunner.Xunit.XUnitFilter;
|
||||
|
||||
namespace DeviceTests
|
||||
{
|
||||
internal static class Traits
|
||||
{
|
||||
public const string DeviceType = "DeviceType";
|
||||
|
||||
internal static class DeviceTypes
|
||||
{
|
||||
public const string Physical = "Physical";
|
||||
public const string Virtual = "Virtual";
|
||||
|
||||
internal static string ToExclude =>
|
||||
DeviceInfo.DeviceType == RuntimeDeviceType.Physical ? Virtual : Physical;
|
||||
}
|
||||
|
||||
internal static List<XUnitFilter> GetCommonTraits(params XUnitFilter[] additionalFilters)
|
||||
{
|
||||
var filters = new List<XUnitFilter>
|
||||
{
|
||||
new XUnitFilter(DeviceType, DeviceTypes.ToExclude, true)
|
||||
};
|
||||
|
||||
if (additionalFilters != null && additionalFilters.Any())
|
||||
filters.AddRange(additionalFilters);
|
||||
|
||||
return filters;
|
||||
}
|
||||
}
|
||||
}
|