public void Contains() { TestDefaultHeaders headers = NewInstance(); headers.AddBoolean(Of("boolean"), true); Assert.True(headers.ContainsBoolean(Of("boolean"), true)); Assert.False(headers.ContainsBoolean(Of("boolean"), false)); headers.AddLong(Of("long"), long.MaxValue); Assert.True(headers.ContainsLong(Of("long"), long.MaxValue)); Assert.False(headers.ContainsLong(Of("long"), long.MinValue)); headers.AddInt(Of("int"), int.MinValue); Assert.True(headers.ContainsInt(Of("int"), int.MinValue)); Assert.False(headers.ContainsInt(Of("int"), int.MaxValue)); headers.AddShort(Of("short"), short.MaxValue); Assert.True(headers.ContainsShort(Of("short"), short.MaxValue)); Assert.False(headers.ContainsShort(Of("short"), short.MinValue)); headers.AddChar(Of("char"), char.MaxValue); Assert.True(headers.ContainsChar(Of("char"), char.MaxValue)); Assert.False(headers.ContainsChar(Of("char"), char.MinValue)); headers.AddByte(Of("byte"), byte.MaxValue); Assert.True(headers.ContainsByte(Of("byte"), byte.MaxValue)); Assert.False(headers.ContainsByte(Of("byte"), byte.MinValue)); headers.AddDouble(Of("double"), double.MaxValue); Assert.True(headers.ContainsDouble(Of("double"), double.MaxValue)); Assert.False(headers.ContainsDouble(Of("double"), double.MinValue)); headers.AddFloat(Of("float"), float.MaxValue); Assert.True(headers.ContainsFloat(Of("float"), float.MaxValue)); Assert.False(headers.ContainsFloat(Of("float"), float.MinValue)); long millis = (long)Math.Floor(DateTime.UtcNow.Ticks / (double)TimeSpan.TicksPerMillisecond); headers.AddTimeMillis(Of("millis"), millis); Assert.True(headers.ContainsTimeMillis(Of("millis"), millis)); // This test doesn't work on midnight, January 1, 1970 UTC Assert.False(headers.ContainsTimeMillis(Of("millis"), 0)); headers.AddObject(Of("object"), "Hello World"); Assert.True(headers.ContainsObject(Of("object"), "Hello World")); Assert.False(headers.ContainsObject(Of("object"), "")); headers.Add(Of("name"), Of("value")); Assert.True(headers.Contains(Of("name"), Of("value"))); Assert.False(headers.Contains(Of("name"), Of("value1"))); }
public void CanMixConvertedAndNormalValues() { TestDefaultHeaders headers = NewInstance(); headers.Add(Of("name"), Of("value")); headers.AddInt(Of("name"), 100); headers.AddBoolean(Of("name"), false); Assert.Equal(3, headers.Size); Assert.True(headers.Contains(Of("name"))); Assert.True(headers.Contains(Of("name"), Of("value"))); Assert.True(headers.ContainsInt(Of("name"), 100)); Assert.True(headers.ContainsBoolean(Of("name"), false)); }