示例#1
0
        public void EqualsIsImplemented()
        {
            Density v = Density.FromKilogramsPerCubicMeter(1);

            Assert.True(v.Equals(Density.FromKilogramsPerCubicMeter(1)));
            Assert.False(v.Equals(Density.Zero));
        }
示例#2
0
            public void ShouldReturnFalseWhenInstanceIsNotEqual()
            {
                var first  = new Density(10, 5);
                var second = new Density(5, 10);

                Assert.IsFalse(first.Equals(second));
            }
示例#3
0
            public void ShouldReturnFalseWhenObjectIsNotEqual()
            {
                var first  = new Density(10, 5);
                var second = new Density(5, 10);

                Assert.IsFalse(first.Equals((object)second));
            }
示例#4
0
            public void ShouldReturnTrueWhenInstanceIsEqual()
            {
                var first  = new Density(50);
                var second = new Density(50);

                Assert.IsTrue(first.Equals(second));
            }
示例#5
0
            public void ShouldReturnTrueWhenObjectIsEqual()
            {
                var first  = new Density(50);
                var second = new Density(50);

                Assert.IsTrue(first.Equals((object)second));
            }
示例#6
0
        public void Test_IEquatable()
        {
            Density first  = new Density(50.0);
            Density second = new Density(50);

            Assert.IsTrue(first == second);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(first.Equals((object)second));

            first  = new Density(50.0);
            second = new Density(50, DensityUnit.PixelsPerCentimeter);

            Assert.IsFalse(first == second);
            Assert.IsFalse(first.Equals(second));
            Assert.IsFalse(first.Equals((object)second));

            Assert.IsFalse(first == null);
            Assert.IsFalse(first.Equals(null));
            Assert.IsFalse(first.Equals((object)null));
        }
示例#7
0
 public bool Equals(PhysicalProperties other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Enabled == other.Enabled && Density.Equals(other.Density) && Friction.Equals(other.Friction) && Elasticity.Equals(other.Elasticity) && FrictionWeight.Equals(other.FrictionWeight) && ElasticityWeight.Equals(other.ElasticityWeight));
 }
示例#8
0
        public void EqualsReturnsFalseOnNull()
        {
            Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1);

            Assert.False(kilogrampercubicmeter.Equals(null));
        }
示例#9
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1);

            Assert.False(kilogrampercubicmeter.Equals(new object()));
        }
示例#10
0
            public void ShouldReturnTrueWhenObjectIsTheSame()
            {
                var density = new Density(50);

                Assert.IsTrue(density.Equals((object)density));
            }
示例#11
0
            public void ShouldReturnTrueWhenInstanceIsTheSame()
            {
                var density = new Density(50);

                Assert.IsTrue(density.Equals(density));
            }
示例#12
0
            public void ShouldReturnFalseWhenInstanceIsNull()
            {
                var density = new Density(50);

                Assert.IsFalse(density.Equals(null));
            }
示例#13
0
    public void Test_IEquatable()
    {
      Density first = new Density(50.0);
      Density second = new Density(50);

      Assert.IsTrue(first == second);
      Assert.IsTrue(first.Equals(second));
      Assert.IsTrue(first.Equals((object)second));

      first = new Density(50.0);
      second = new Density(50, DensityUnit.PixelsPerCentimeter);

      Assert.IsFalse(first == second);
      Assert.IsFalse(first.Equals(second));
      Assert.IsFalse(first.Equals((object)second));

      Assert.IsFalse(first == null);
      Assert.IsFalse(first.Equals(null));
      Assert.IsFalse(first.Equals((object)null));
    }
示例#14
0
 public bool Equals(DisplayInfo other) =>
 Width.Equals(other.Width) &&
 Height.Equals(other.Height) &&
 Density.Equals(other.Density) &&
 Orientation.Equals(other.Orientation) &&
 Rotation.Equals(other.Rotation);