示例#1
0
        public void ObjectValueSource_Prop()
        {
            var test = new TestObject();

            Assert.AreEqual(StringValue, test.GetValue(GoodValueName));
            AssertPlus.Throws(() => { var dummy = test.GetValue(BadValueName); });
        }
示例#2
0
        public void AtomCollectionData_Named()
        {
            var named1  = MakeNamedAtom();
            var named2  = MakeNamedAtom();
            var unnamed = MakeUnnamedAtom();

            var data = new AtomCollectionData();

            data.AddAtom(named1);
            AssertPlus.Throws(() => { data.AddAtom(unnamed); });
            Assert.IsNull(data[named2.Name]);
            data.AddAtom(named2);
            Assert.AreEqual(named2, data[named2.Name]);

            Assert.AreEqual(2, data.Atoms.Count());
        }
示例#3
0
        public void AtomCollectionData_Unnamed()
        {
            var named    = MakeNamedAtom();
            var unnamed1 = MakeUnnamedAtom();
            var unnamed2 = MakeUnnamedAtom();

            var data = new AtomCollectionData();

            data.AddAtom(unnamed1);
            data.AddAtom(unnamed2);
            data.AddAtom(unnamed1);
            AssertPlus.Throws(() => { data.AddAtom(named); });
            AssertPlus.Throws(() => { var atom = data[named.Name]; });

            Assert.AreEqual(3, data.Atoms.Count());
            var atoms = data.Atoms.ToArray();

            Assert.AreEqual(unnamed1, atoms[2]);
            Assert.AreEqual(unnamed2, atoms[1]);
        }