forked from HiroyukiSakoh/EchoDotNetLite
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make EchonetObjectSpecification.XxxProperties IReadOnlyDictionary
- Loading branch information
Showing
8 changed files
with
189 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...Smdn.Net.EchonetLite.Appendix/Smdn.Net.EchonetLite.Appendix/EchonetObjectSpecification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// SPDX-FileCopyrightText: 2024 smdn <smdn@smdn.jp> | ||
// SPDX-License-Identifier: MIT | ||
using System; | ||
using System.Linq; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
using System.Reflection; | ||
|
||
using NUnit.Framework; | ||
|
||
namespace Smdn.Net.EchonetLite.Appendix; | ||
|
||
[TestFixture] | ||
public class EchonetObjectSpecificationTests { | ||
[Test] | ||
public void GetProperties_NodeProfile() | ||
{ | ||
Assert.That(Profiles.NodeProfile.GetProperties.Count, Is.EqualTo(18)); | ||
} | ||
|
||
// 0x0EF0 ノードプロファイル | ||
[TestCase(0x80, true)] | ||
[TestCase(0x82, true)] | ||
[TestCase(0x83, true)] | ||
[TestCase(0x89, true)] | ||
[TestCase(0xBF, true)] | ||
[TestCase(0xD3, true)] | ||
[TestCase(0xD4, true)] | ||
[TestCase(0xD6, true)] | ||
[TestCase(0xD7, true)] | ||
// プロファイルオブジェクトスーパークラス | ||
[TestCase(0x88, true)] | ||
[TestCase(0x8A, true)] | ||
[TestCase(0x8B, true)] | ||
[TestCase(0x8C, true)] | ||
[TestCase(0x8D, true)] | ||
[TestCase(0x8E, true)] | ||
[TestCase(0x8F, false)] | ||
[TestCase(0x9D, true)] | ||
[TestCase(0x9E, true)] | ||
[TestCase(0x9F, true)] | ||
// not defined | ||
[TestCase(0x00, false)] | ||
[TestCase(0xFF, false)] | ||
public void GetProperties_NodeProfile_ByEPC(byte epc, bool expected) | ||
{ | ||
Assert.That(Profiles.NodeProfile.GetProperties.TryGetValue(epc, out var p), Is.EqualTo(expected)); | ||
|
||
if (expected) | ||
Assert.That(p, Is.Not.Null); | ||
} | ||
|
||
[Test] | ||
public void SetProperties_NodeProfile() | ||
{ | ||
Assert.That(Profiles.NodeProfile.SetProperties.Count, Is.EqualTo(2)); | ||
} | ||
|
||
// 0x0EF0 ノードプロファイル | ||
[TestCase(0x80, true)] | ||
[TestCase(0xBF, true)] | ||
// プロファイルオブジェクトスーパークラス | ||
[TestCase(0x8F, false)] | ||
// not defined | ||
[TestCase(0x00, false)] | ||
[TestCase(0xFF, false)] | ||
public void SetProperties_NodeProfile_ByEPC(byte epc, bool expected) | ||
{ | ||
Assert.That(Profiles.NodeProfile.SetProperties.TryGetValue(epc, out var p), Is.EqualTo(expected)); | ||
|
||
if (expected) | ||
Assert.That(p, Is.Not.Null); | ||
} | ||
|
||
[Test] | ||
public void AnnoProperties_NodeProfile() | ||
{ | ||
Assert.That(Profiles.NodeProfile.AnnoProperties.Count, Is.EqualTo(2)); | ||
} | ||
|
||
// 0x0EF0 ノードプロファイル | ||
[TestCase(0x80, true)] | ||
[TestCase(0xD5, true)] | ||
[TestCase(0xD6, false)] | ||
// プロファイルオブジェクトスーパークラス | ||
[TestCase(0x8F, false)] | ||
// not defined | ||
[TestCase(0x00, false)] | ||
[TestCase(0xFF, false)] | ||
public void AnnoProperties_NodeProfile_ByEPC(byte epc, bool expected) | ||
{ | ||
Assert.That(Profiles.NodeProfile.AnnoProperties.TryGetValue(epc, out var p), Is.EqualTo(expected)); | ||
|
||
if (expected) | ||
Assert.That(p, Is.Not.Null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.