Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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);
        }