protected void TestOptionsBase(FormatterOptions options) { { int min = int.MaxValue, max = int.MinValue; foreach (var value in ToEnumConverter.GetNumberBaseValues()) { min = Math.Min(min, (int)value); max = Math.Max(max, (int)value); options.NumberBase = value; } Assert.Throws <ArgumentOutOfRangeException>(() => options.NumberBase = (NumberBase)(min - 1)); Assert.Throws <ArgumentOutOfRangeException>(() => options.NumberBase = (NumberBase)(max + 1)); Assert.Throws <ArgumentOutOfRangeException>(() => options.NumberBase = (NumberBase)int.MinValue); Assert.Throws <ArgumentOutOfRangeException>(() => options.NumberBase = (NumberBase)int.MaxValue); } { int min = int.MaxValue, max = int.MinValue; foreach (var value in ToEnumConverter.GetMemorySizeOptionsValues()) { min = Math.Min(min, (int)value); max = Math.Max(max, (int)value); options.MemorySizeOptions = value; } Assert.Throws <ArgumentOutOfRangeException>(() => options.MemorySizeOptions = (MemorySizeOptions)(min - 1)); Assert.Throws <ArgumentOutOfRangeException>(() => options.MemorySizeOptions = (MemorySizeOptions)(max + 1)); Assert.Throws <ArgumentOutOfRangeException>(() => options.MemorySizeOptions = (MemorySizeOptions)int.MinValue); Assert.Throws <ArgumentOutOfRangeException>(() => options.MemorySizeOptions = (MemorySizeOptions)int.MaxValue); } }