Beispiel #1
0
        public void GetOrCreateValue()
        {
            var context = new TestContextBase();

            Assert.That(context.GetOrCreateValue <TestValueA>(), Is.Not.Null);
            Assert.That(context.HasValue <TestValueA>(), Is.True);
            Assert.That(context.GetValue <TestValueA>(), Is.Not.Null);
            Assert.That(context.Values.Length, Is.EqualTo(1));
            Assert.Throws <InvalidOperationException>(() => context.GetOrCreateValue <object>());
        }
Beispiel #2
0
        public void GetOrCreateValue_WhenValueExist_DoesNotThrow()
        {
            var context = new TestContextBase();

            context.SetValue(new TestValueA());
            Assert.DoesNotThrow(() => context.GetOrCreateValue <TestValueA>());
        }
Beispiel #3
0
        public void GetOrCreateValue()
        {
            var context = new TestContextBase();

            Assert.That(context.GetOrCreateValue <TestValueA>(), Is.Not.Null);
            Assert.That(context.HasValue <TestValueA>(), Is.True);
            Assert.That(context.GetValue <TestValueA>(), Is.Not.Null);
            Assert.That(context.Values.Length, Is.EqualTo(1));
        }