Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions HapSharp.Core.Example/HapSharp.Core.Example.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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>{3C9CBFBB-1DE6-4599-A293-C0CC7DAAA852}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>HapSharp.Core.Example</RootNamespace>
<AssemblyName>HapSharp.Core.Example</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</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>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HapSharpProtocol\HapSharpProtocol.csproj">
<Project>{24CB3D20-D49D-4361-8B78-92726D8477BD}</Project>
<Name>HapSharp.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
12 changes: 12 additions & 0 deletions HapSharp.Core.Example/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace HapSharp.Core.Example
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
}
}
}
26 changes: 26 additions & 0 deletions HapSharp.Core.Example/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle ("HapSharp.Core.Example")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("${AuthorCopyright}")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
39 changes: 39 additions & 0 deletions HapSharp.Core.Tests/Chacha20poly1305_Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using NUnit.Framework;

namespace HapSharp.Core.Tests
{
class Chacha20poly1305_Tests
{
[Test ()]
public void load32_test ()
{
var test = new int[16];
test[1] = 1;
test[2] = 2;
test[3] = 2;
var result = Chacha20poly1305.load32 (test, 0);
Assert.AreEqual (33685760, result);
}

[Test ()]
public void store32_test ()
{
var test = new int[16];
test[1] = 1;
test[2] = 2;
test[3] = 2;

Chacha20poly1305.store32 (test, 0, 2);
Assert.AreEqual (2, test[0]);
Assert.AreEqual (0, test[1]);
Assert.AreEqual (0, test[2]);
}

[Test ()]
public void plus_test ()
{
var result = Chacha20poly1305.plus (5, 6);
Assert.AreEqual (11, result);
}
}
}
48 changes: 48 additions & 0 deletions HapSharp.Core.Tests/HapSharp.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?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>{7FDBCF30-37C2-43A4-9B0A-6EBE5E340D14}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>HapSharp.Core.Tests</RootNamespace>
<AssemblyName>HapSharp.Core.Tests</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</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>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Test.cs" />
<Compile Include="Chacha20poly1305_Tests.cs" />
<Compile Include="UUID_Tests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HapSharp.Core\HapSharp.Core.csproj">
<Project>{24CB3D20-D49D-4361-8B78-92726D8477BD}</Project>
<Name>HapSharp.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
48 changes: 48 additions & 0 deletions HapSharp.Core.Tests/Test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using NUnit.Framework;
using System;
namespace HapSharp.Core.Tests
{
[TestFixture ()]
public class AccessoryTests
{
readonly Service service;

[Test ()]
public void Bridge_CheckInitialValues ()
{
var bridgeGuid = Guid.NewGuid ();
var bridge = new Bridge ("bridge", bridgeGuid);
Assert.IsTrue (bridge._isBridge);
}

[Test ()]
public void Accessory_CheckInitialValues ()
{
string accessoryName = "test";
var accessoryGuid = Guid.NewGuid ();

var accessory = new Accessory (accessoryName, accessoryGuid);
Assert.AreEqual (accessoryGuid, accessory.UUID);
Assert.AreEqual (AccessoryCategory.OTHER, accessory.Category);
Assert.AreEqual (0, accessory.BridgedAccessories.Count);

Assert.IsFalse (accessory._isBridge);

Assert.AreEqual (5, accessory.serviceCharacteristic.Count);
Assert.IsTrue (accessory.serviceCharacteristic.TryGetValue (ServiceCharacteristicType.Manufacturer, out string manufacturer));
Assert.AreEqual ("Default-Manufacturer", manufacturer);

Assert.IsTrue (accessory.serviceCharacteristic.TryGetValue (ServiceCharacteristicType.Name, out string displayName));
Assert.AreEqual (accessoryName, displayName);

Assert.IsTrue (accessory.serviceCharacteristic.TryGetValue (ServiceCharacteristicType.Model, out string model));
Assert.AreEqual ("Default-Model", model);

Assert.IsTrue (accessory.serviceCharacteristic.TryGetValue (ServiceCharacteristicType.SerialNumber, out string serial));
Assert.AreEqual ("Default-SerialNumber", serial);

Assert.IsTrue (accessory.serviceCharacteristic.TryGetValue (ServiceCharacteristicType.FirmwareRevision, out string firmwareRevision));
Assert.AreEqual ("1.0", firmwareRevision);
}
}
}
16 changes: 16 additions & 0 deletions HapSharp.Core.Tests/UUID_Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using NUnit.Framework;
using System;
namespace HapSharp.Core.Tests
{
[TestFixture ()]
class UUID_Tests
{
[Test ()]
public void Bridge_CheckInitialValues ()
{
var bridgeGuid = Guid.NewGuid ();
var bridge = new Bridge ("bridge", bridgeGuid);
Assert.IsTrue (bridge._isBridge);
}
}
}
4 changes: 4 additions & 0 deletions HapSharp.Core.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net461" />
</packages>
29 changes: 29 additions & 0 deletions HapSharp.Core.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HapSharp.Core", "HapSharp.Core\HapSharp.Core.csproj", "{24CB3D20-D49D-4361-8B78-92726D8477BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HapSharp.Core.Example", "HapSharp.Core.Example\HapSharp.Core.Example.csproj", "{3C9CBFBB-1DE6-4599-A293-C0CC7DAAA852}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HapSharp.Core.Tests", "HapSharp.Core.Tests\HapSharp.Core.Tests.csproj", "{7FDBCF30-37C2-43A4-9B0A-6EBE5E340D14}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{24CB3D20-D49D-4361-8B78-92726D8477BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24CB3D20-D49D-4361-8B78-92726D8477BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24CB3D20-D49D-4361-8B78-92726D8477BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24CB3D20-D49D-4361-8B78-92726D8477BD}.Release|Any CPU.Build.0 = Release|Any CPU
{3C9CBFBB-1DE6-4599-A293-C0CC7DAAA852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C9CBFBB-1DE6-4599-A293-C0CC7DAAA852}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C9CBFBB-1DE6-4599-A293-C0CC7DAAA852}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C9CBFBB-1DE6-4599-A293-C0CC7DAAA852}.Release|Any CPU.Build.0 = Release|Any CPU
{7FDBCF30-37C2-43A4-9B0A-6EBE5E340D14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7FDBCF30-37C2-43A4-9B0A-6EBE5E340D14}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7FDBCF30-37C2-43A4-9B0A-6EBE5E340D14}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7FDBCF30-37C2-43A4-9B0A-6EBE5E340D14}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Loading