Initial version.

This commit is contained in:
Oliver Hauff 2021-05-13 17:07:16 +02:00
commit 6bab491a21
40 changed files with 1812 additions and 0 deletions

View file

@ -0,0 +1,29 @@
using NUnit.Framework;
using TINK.Model.Bike.BluetoothLock;
namespace TINK.Services.BluetoothLock.Exception
{
[TestFixture]
public class TestCouldntCloseInconsistentStateExecption
{
[Test]
public void TestCtor_Unknown()
{
var ex = new CouldntCloseInconsistentStateExecption(LockingState.Unknown);
Assert.That(
ex.Message,
Is.EqualTo("Lock reports unknown bold position."));
}
[Test]
public void TestCtor_Open()
{
var ex = new CouldntCloseInconsistentStateExecption(LockingState.Open);
Assert.That(
ex.Message,
Does.Contain("locking state \"Open\""));
}
}
}

View file

@ -0,0 +1,29 @@
using NUnit.Framework;
using TINK.Model.Bike.BluetoothLock;
namespace TINK.Services.BluetoothLock.Exception
{
[TestFixture]
public class TestCouldntOpenInconsistentStateExecption
{
[Test]
public void TestCtor_Unknown()
{
var ex = new CouldntOpenInconsistentStateExecption(LockingState.Unknown);
Assert.That(
ex.Message,
Is.EqualTo("Lock reports unknown bold position."));
}
[Test]
public void TestCtor_Open()
{
var ex = new CouldntOpenInconsistentStateExecption(LockingState.Closed);
Assert.That(
ex.Message,
Does.Contain("locking state \"Closed\""));
}
}
}

View file

@ -0,0 +1,28 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
namespace TINK.Services.BluetoothLock
{
[TestFixture]
public class TestTimeOutProvider
{
[Test]
public void TestCtor()
{
Assert.That(new TimeOutProvider().MultiConnect.TotalSeconds, Is.EqualTo(5), "Unexpected bluetooth default timeout detected.");
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).MultiConnect.TotalSeconds, Is.EqualTo(4));
}
[Test]
public void TestGetSingleConnect()
{
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(1).TotalSeconds, Is.EqualTo(4));
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(2).TotalSeconds, Is.EqualTo(8));
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(3).TotalSeconds, Is.EqualTo(12));
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(4).TotalSeconds, Is.EqualTo(16));
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(5).TotalSeconds, Is.EqualTo(16));
}
}
}

View file

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>TINK</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="nunit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LockItShared\LockItShared.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31229.75
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestLockItShared", "TestLockItShared.csproj", "{0432F508-8B41-4CA3-A1FC-38906346B82A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LockItShared", "..\LockItShared\LockItShared.csproj", "{A8AC4131-BF07-46BE-A8E2-51CB5CADA37E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0432F508-8B41-4CA3-A1FC-38906346B82A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0432F508-8B41-4CA3-A1FC-38906346B82A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0432F508-8B41-4CA3-A1FC-38906346B82A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0432F508-8B41-4CA3-A1FC-38906346B82A}.Release|Any CPU.Build.0 = Release|Any CPU
{A8AC4131-BF07-46BE-A8E2-51CB5CADA37E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8AC4131-BF07-46BE-A8E2-51CB5CADA37E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8AC4131-BF07-46BE-A8E2-51CB5CADA37E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A8AC4131-BF07-46BE-A8E2-51CB5CADA37E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6DF9BEE1-A4B7-4785-AFDA-BA5DEFAE50A3}
EndGlobalSection
EndGlobal