public void GetValueWithLoader() { Assert.Equal(_list, _loaded.GetValue(_ => _list)); Assert.Equal(_dict, _unloaded.GetValue(_ => _dict)); Assert.Equal(_dict, _unloaded.LoadedValue); Assert.Throws <InvalidOperationException>(() => _default.GetValue(_ => _dict)); Assert.Null(_default.LoadedValue); }
public void DefaultConstructor() { IndirectValue d = default; Assert.Null(d.LoadedValue); Assert.Throws <InvalidOperationException>(() => d.Fingerprint); Assert.Throws <ArgumentNullException>(() => d.GetValue(null)); Assert.Throws <InvalidOperationException>(() => d.GetValue(_ => _list)); }
public void Constructors() { var loaded = new IndirectValue(_list); Assert.Equal(_list, loaded.LoadedValue); Assert.Equal(_list, loaded.GetValue(null)); var unloaded = new IndirectValue(_dict.Fingerprint); Assert.Null(unloaded.LoadedValue); Assert.Equal(_dict.Fingerprint, unloaded.Fingerprint); }