예제 #1
0
        public void Multiply_AxBsquared_EqualsAxAxBxB()
        {
            // Arrange
            IDimension        a    = CreateStubDimension("a");
            IDimension        b    = CreateStubDimension("b");
            CompoundDimension unit = new CompoundDimension(a);
            CompoundDimension axb  = (CompoundDimension)unit.Multiply(b);

            // Act
            IDimension axbsquared = axb.Multiply(axb);
            IDimension axaxbxb    = unit.Multiply(a, b, b);

            // Assert
            Assert.AreEqual(axaxbxb, axbsquared);
        }
예제 #2
0
        public void Multiply_AxB_ReturnsCompoundUnit()
        {
            // Arrange
            IDimension        a    = CreateStubDimension("a");
            IDimension        b    = CreateStubDimension("b");
            CompoundDimension unit = new CompoundDimension(a);

            // Act
            IDimension result = unit.Multiply(b);

            // Assert
            Assert.IsInstanceOf(typeof(CompoundDimension), result);
        }
예제 #3
0
        public void Multiply_AoverBx1_ReturnsSelf()
        {
            // Arrange
            IDimension        a         = CreateStubDimension("a");
            IDimension        b         = CreateStubDimension("b");
            CompoundDimension dimension = new CompoundDimension(a, b);

            // Act
            IDimension result = dimension.Multiply(Dimsensionless.Instance);

            // Assert
            Assert.AreSame(dimension, result);
        }
예제 #4
0
        public void Multiply_AoverBxB_ReturnsA()
        {
            // Arrange
            IDimension        a    = CreateStubDimension("a");
            IDimension        b    = CreateStubDimension("b");
            CompoundDimension unit = new CompoundDimension(a);

            unit = (CompoundDimension)unit.Divide(b);

            // Act
            IDimension result = unit.Multiply(b);

            // Assert
            Assert.AreSame(a, result);
        }
예제 #5
0
 /// <summary>
 /// Multiply the current dimension with the dimension(s) given.
 /// </summary>
 /// <param name="dimensions">One or more dimensions.</param>
 public DimensionCreator Multiply(params IDimension[] dimensions)
 {
     UpdateDimension(_dimension.Multiply(dimensions));
     return(this);
 }