public void IdentifierCache_Add() { IIdentifier <string> identCache = new IdentifierCache <string>(new Identifier <string>(), 1); var code = identCache.Add("item"); Assert.Equal(1ul, code); }
public void IdentifierCache_Items() { IIdentifier <string> identCache = new IdentifierCache <string>(new Identifier <string>(), 1); var items = identCache.Items; Assert.NotNull(items); }
public void IdentifierCache_GetEnumerator() { IIdentifier <string> identCache = new IdentifierCache <string>(new Identifier <string>(), 1); var code1 = identCache.Add("item"); Assert.True(identCache.TryGetValue(code1, out _)); Assert.NotNull(identCache.GetEnumerator()); }
public void IdentifierCache_Clear() { IIdentifier <string> identCache = new IdentifierCache <string>(new Identifier <string>(), 1); var code = identCache.Add("item"); Assert.True(identCache.TryGetValue(code, out var item)); identCache.Clear(); Assert.False(identCache.TryGetValue(code, out _)); }
public void IdentifierCache_TryGetValue() { IIdentifier <string> identCache = new IdentifierCache <string>(new Identifier <string>(), 1); var code = identCache.Add("item"); identCache.TryGetValue("item", out var result); Assert.Equal(code, result); identCache.TryGetValue(code, out var item); Assert.Equal("item", item); }
/// <summary> /// Initializes a new instance of the <see cref="MsgPackEventSerializer"/> class. /// </summary> public MsgPackEventSerializer() { this.identifierCache = new IdentifierCache(); }
/// <summary> /// Initializes a new instance of the <see cref="MsgPackCommandSerializer"/> class. /// </summary> public MsgPackCommandSerializer() { this.identifierCache = new IdentifierCache(); this.orderSerializer = new MsgPackOrderSerializer(); }