33 lines
912 B
C#
33 lines
912 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using bts.api;
|
|
using bts.test;
|
|
|
|
namespace bts.mcore
|
|
{
|
|
[TestGroup]
|
|
class SecurityTests {
|
|
[Test]
|
|
public void test_security_equal() {
|
|
|
|
SecurityImmutable a = new SecurityImmutable(new Security() { Id = 42 });
|
|
SecurityImmutable b = new SecurityImmutable(new Security() { Id = 42 });
|
|
SecurityImmutable c = new SecurityImmutable(new Security() { Id = 4 });
|
|
|
|
Assert.IsTrue(a == b);
|
|
Assert.IsTrue(a.Equals(b));
|
|
Assert.IsFalse(a == c);
|
|
Assert.IsFalse(a.Equals(c));
|
|
|
|
Dictionary<SecurityImmutable, int> dict = new Dictionary<SecurityImmutable, int>();
|
|
dict[a] = 1;
|
|
dict[c] = 2;
|
|
Assert.That(dict[b] == 1);
|
|
Assert.That(dict[c] == 2);
|
|
}
|
|
}
|
|
}
|