IScalars IScalars.Add(Scalar value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } if (value == this) { return(this); } return(Scalars.New(this, value)); }
public void Scalars_IsSupersetOf() { Assert.IsTrue(Scalars.Empty.IsSubsetOf(Scalars.Empty)); var container = ScalarContainerMock.New(); var scalar1 = container.CreateNew <int>(); var scalar2 = container.CreateNew <int>(); var scalar1And2 = Scalars.New(scalar1, scalar2); Assert.IsTrue(scalar1And2.IsSupersetOf(scalar1)); Assert.IsTrue(scalar1And2.IsSupersetOf(scalar2)); Assert.IsTrue(scalar1And2.IsSupersetOf(scalar1And2)); }
public void Scalars_New() { { var scalar1 = ScalarContainerMock.New().CreateNew <int>(); Assert.AreEqual(scalar1, Scalars.New(scalar1)); } { var container = ScalarContainerMock.New(); var scalar1 = container.CreateNew <int>(); var scalar2 = container.CreateNew <int>(); var scalars = Scalars.New(scalar1, scalar2); Assert.AreEqual(2, scalars.Count); Assert.IsTrue(scalars.Contains(scalar1)); Assert.IsTrue(scalars.Contains(scalar2)); } }