Moving RpcAttribute into networking project

This commit is contained in:
Chris Cameron
2018-02-02 14:38:58 -05:00
parent 38584ff565
commit 3a693d2e71
4 changed files with 0 additions and 241 deletions

View File

@@ -1,9 +0,0 @@
using NUnit.Framework;
namespace ICD.Common.Utils.Tests.Attributes
{
[TestFixture]
public sealed class KrangPluginAttributeTest : AbstractIcdAttributeTest
{
}
}

View File

@@ -1,55 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using ICD.Common.Utils.Attributes.Rpc;
using NUnit.Framework;
namespace ICD.Common.Utils.Tests.Attributes.Rpc
{
[TestFixture]
public sealed class RpcAttributeTest : AbstractIcdAttributeTest
{
private class TestClass
{
[Rpc("A")]
public string TestProperty { get; set; }
[Rpc("A")]
public void TestMethod()
{
}
[Rpc("B")]
public void TestMethod(int a)
{
}
[Rpc("C")]
public void TestMethod(int a, string b)
{
}
}
[Test]
public void GetMethodTest()
{
TestClass instance = new TestClass();
Assert.NotNull(RpcAttribute.GetMethod(instance, "A", new object[] { }));
Assert.Null(RpcAttribute.GetMethod(instance, "B", new object[] { }));
Assert.NotNull(RpcAttribute.GetMethod(instance, "B", new object[] { 1 }));
Assert.NotNull(RpcAttribute.GetMethod(instance, "C", new object[] { 1, null }));
Assert.NotNull(RpcAttribute.GetMethod(instance, "C", new object[] { 1, "test" }));
}
[Test]
public void GetPropertyTest()
{
TestClass instance = new TestClass();
Assert.NotNull(RpcAttribute.GetProperty(instance, "A", "test"));
Assert.NotNull(RpcAttribute.GetProperty(instance, "A", null));
Assert.Null(RpcAttribute.GetProperty(instance, "B", "test"));
Assert.Null(RpcAttribute.GetProperty(instance, "B", 1));
}
}
}