예제 #1
0
        public void Clone_FlatMultExpression()
        {
            //Arrange
            var expression = new FlatMultExpression();

            expression.Add(new VariableExpression("x", 1));
            expression.Add(new NumberExpression(3));

            //Act
            var clone = (FlatMultExpression)expression.Clone();

            //Assert
            Assert.IsTrue(DimensionKey.Compare(expression.DimensionKey, clone.DimensionKey));
            Assert.IsTrue(FlatExpression.Compare(expression, clone));
        }
예제 #2
0
        public void Clone_FlatMultExpression()
        {
            //Arrange
            var expected = new FlatMultExpression();

            expected.Add(new VariableExpression("x", 1));
            expected.Add(new VariableExpression("y", 1));
            expected.Count = new Complex(3, 2);

            //Act
            var actual = (FlatMultExpression)expected.Clone();

            //Assert
            Assert.IsTrue(!Object.ReferenceEquals(actual, expected));
            CollectionAssert.AreEquivalent(expected.Expressions, actual.Expressions);
            Assert.AreEqual(expected.Count.Re.Numerator, actual.Count.Re.Numerator);
            Assert.AreEqual(expected.Count.Re.Denominator, actual.Count.Re.Denominator);
            Assert.AreEqual(expected.Count.Im.Numerator, actual.Count.Im.Numerator);
            Assert.AreEqual(expected.Count.Im.Denominator, actual.Count.Im.Denominator);
        }