public void EventArgWithBoolPropertyTests() { var arg = new EventArgWithProperty <bool> { Value = true }; var name = nameof(EventArgWithProperty <bool> .Value); Assert.IsTrue(Matches(b => b.Add(name, null), arg)); Assert.IsTrue(Matches(b => b.Add(name, " "), arg)); Assert.IsTrue(Matches(b => b.Add(name, "True"), arg)); Assert.IsTrue(Matches(b => b.Add(name, "TRUE"), arg)); Assert.IsFalse(Matches(b => b.Add(name, "false"), arg)); }
public void EventArgWithDecimalPropertyTests() { var arg = new EventArgWithProperty <decimal> { Value = 123 }; var name = nameof(EventArgWithProperty <decimal> .Value); Assert.IsTrue(Matches(b => b.Add(name, null), arg)); Assert.IsTrue(Matches(b => b.Add(name, " "), arg)); Assert.IsTrue(Matches(b => b.Add(name, "123"), arg)); Assert.IsTrue(Matches(b => b.Add(name, "1,2,123,432"), arg)); Assert.IsFalse(Matches(b => b.Add(name, "1234,32"), arg)); }
public void EventArgWithGuidPropertyTests() { var arg = new EventArgWithProperty <Guid> { Value = Guid.NewGuid() }; var name = nameof(EventArgWithProperty <bool> .Value); Assert.IsTrue(Matches(b => b.Add(name, null), arg)); Assert.IsTrue(Matches(b => b.Add(name, " "), arg)); Assert.IsTrue(Matches(b => b.Add(name, arg.Value.ToString("N")), arg)); Assert.IsTrue(Matches(b => b.Add(name, arg.Value.ToString("D")), arg)); Assert.IsTrue(Matches(b => b.Add(name, arg.Value.ToString("B")), arg)); Assert.IsTrue(Matches(b => b.Add(name, arg.Value.ToString("P")), arg)); Assert.IsTrue(Matches(b => b.Add(name, arg.Value.ToString("X")), arg)); Assert.IsTrue(Matches(b => b.Add(name, arg.Value.ToString()), arg)); }