public void Allowed_Alias() { var policy = new MultiAddressWhiteList { _a }; Assert.IsTrue(policy.IsAllowed(_a)); Assert.IsTrue(policy.IsAllowed(_a1)); Assert.IsTrue(policy.IsAllowed(_b)); Assert.IsFalse(policy.IsAllowed(_c)); Assert.IsFalse(policy.IsAllowed(_d)); }
public void Collection() { MultiAddress addressA = "/ip4/127.0.0.1"; MultiAddress addressB = "/ip4/127.0.0.2"; var policy = new MultiAddressWhiteList(); Assert.IsFalse(policy.IsReadOnly); Assert.AreEqual(0, policy.Count); Assert.IsFalse(policy.Contains(addressA)); Assert.IsFalse(policy.Contains(addressB)); policy.Add(addressA); Assert.AreEqual(1, policy.Count); Assert.IsTrue(policy.Contains(addressA)); Assert.IsFalse(policy.Contains(addressB)); policy.Add(addressA); Assert.AreEqual(1, policy.Count); Assert.IsTrue(policy.Contains(addressA)); Assert.IsFalse(policy.Contains(addressB)); policy.Add(addressB); Assert.AreEqual(2, policy.Count); Assert.IsTrue(policy.Contains(addressA)); Assert.IsTrue(policy.Contains(addressB)); policy.Remove(addressB); Assert.AreEqual(1, policy.Count); Assert.IsTrue(policy.Contains(addressA)); Assert.IsFalse(policy.Contains(addressB)); var array = new MultiAddress[1]; policy.CopyTo(array, 0); Assert.AreSame(addressA, array[0]); foreach (var filter in policy) { Assert.AreSame(addressA, filter); } policy.Clear(); Assert.AreEqual(0, policy.Count); Assert.IsFalse(policy.Contains(addressA)); Assert.IsFalse(policy.Contains(addressB)); }
public void Empty() { var policy = new MultiAddressWhiteList(); Assert.IsTrue(policy.IsAllowed(_a)); }