public void ObjectCapacityExceeded_RemovedFromPool() { int poolSize = 10; using (var test = new Perf.PoolBoy <Txt.StringBuilder>()) { var stringBuilder = new Perf.Text.StringBuilder(poolSize: poolSize); stringBuilder.Append("I want to test this out."); stringBuilder.IsPoolAllocated.Should().BeTrue(); stringBuilder.Dispose(); } }
public void ByCharacteristic_PoolKey_ShouldBeSame(int?capacity, int?maxCapacity, string poolKey) { using (var test = new Perf.PoolBoy <Txt.StringBuilder>()) { var stringBuilder = new Perf.Text.StringBuilder(capacity, maxCapacity, poolKey); stringBuilder.Append("I want to test this out."); stringBuilder.Dispose(DONOTCLEAR); test.ResetItemCounter(); var stringBuilder2 = new Perf.Text.StringBuilder(capacity, maxCapacity, poolKey); stringBuilder2.performanceObject.Should().BeSameAs(stringBuilder.performanceObject); stringBuilder2.ToString().Should().Be(stringBuilder.ToString()); } }