Esempio n. 1
0
        public void Scalars_Union()
        {
            {
                Assert.AreEqual(Scalars.Empty, Scalars.Empty.Union(Scalars.Empty));
            }

            {
                var container = ScalarContainerMock.New();
                var scalar1   = container.CreateNew <int>();
                Assert.AreEqual(scalar1, Scalars.Empty.Union(scalar1));
                Assert.AreEqual(scalar1, scalar1.Union(Scalars.Empty));
            }

            {
                var container = ScalarContainerMock.New();
                var scalar1   = container.CreateNew <int>();
                Assert.AreEqual(scalar1, scalar1.Union(scalar1));
            }

            {
                var container = ScalarContainerMock.New();
                var scalar1   = container.CreateNew <int>();
                var scalar2   = container.CreateNew <int>();
                var scalars   = scalar1.Union(scalar2);
                Assert.AreEqual(2, scalars.Count);
                Assert.IsTrue(scalars.Contains(scalar1));
                Assert.IsTrue(scalars.Contains(scalar2));
            }
        }
Esempio n. 2
0
        public void Scalars_Equals()
        {
            var container = ScalarContainerMock.New();
            var scalar1   = container.CreateNew <int>();

            Assert.IsTrue(!scalar1.Equals(null));
            Assert.IsTrue(!scalar1.Equals(new object()));

            var scalar2 = container.CreateNew <int>();

            var scalars1 = Scalars.Empty.Add(scalar1).Add(scalar2);
            var scalars2 = Scalars.Empty.Add(scalar2).Add(scalar1);

            Assert.IsTrue(scalars1.Equals(scalars2));
        }