Exemplo n.º 1
0
        public void TestEqualMethodWithIntegerParam()
        {
            var firstWeight  = new Weight(7);
            var secondWeight = 5;
            var thirdWeight  = 7;

            Assert.IsFalse(firstWeight.Equals(secondWeight), "Equal method (with integer param) of Weight class does not work properly !");
            Assert.IsTrue(firstWeight.Equals(thirdWeight), "Equal method (with integer param) of Weight class does not work properly !");
        }
Exemplo n.º 2
0
        public void TestEqualMethodWithIntegerParam()
        {
            var firstWeight = new Weight(7);
            var secondWeight = 5;
            var thirdWeight = 7;

            Assert.IsFalse(firstWeight.Equals(secondWeight), "Equal method (with integer param) of Weight class does not work properly !");
            Assert.IsTrue(firstWeight.Equals(thirdWeight), "Equal method (with integer param) of Weight class does not work properly !");
        }
        public void Equals_DoesComparison_ReturnsResult(int left, int right, bool result)
        {
            // Arrange
            var leftWeight  = new Weight(left);
            var rightWeight = new Weight(right);

            // Act
            var actualA = leftWeight.Equals(rightWeight);
            var actualB = leftWeight.Equals((object)rightWeight);

            // Assert
            Assert.Equal(result, actualA);
            Assert.Equal(result, actualB);
        }
Exemplo n.º 4
0
        //Methods


        //Check to see if this Exercise equals an exercise passed in
        public override bool Equals(object obj)
        {
            bool     equals = true;
            Exercise ex     = (Exercise)obj;

            if (!Name.Equals(ex.Name))
            {
                equals = false;
            }
            else if (!ExerciseNumber.Equals(ex.ExerciseNumber))
            {
                equals = false;
            }
            else if (!Weight.Equals(ex.Weight))
            {
                equals = false;
            }
            else if (!Sets.Equals(ex.Sets))
            {
                equals = false;
            }
            else if (!Reps.Equals(ex.Reps))
            {
                equals = false;
            }
            else if (!LastSetReps.Equals(ex.LastSetReps))
            {
                equals = false;
            }
            return(equals);
        }
 /// <summary>
 /// Two DnsResourceDataUri are equal iff their priority, weight and target fields are equal.
 /// </summary>
 public bool Equals(DnsResourceDataUri other)
 {
     return(other != null &&
            Priority.Equals(other.Priority) &&
            Weight.Equals(other.Weight) &&
            Target.SequenceEqual(other.Target));
 }
Exemplo n.º 6
0
        public void TestNotEquals()
        {
            Weight d1 = new Weight(3.25m, Weight.UnitType.G);
            Weight w1 = new Weight(15, Weight.UnitType.Kg);

            Assert.IsFalse(d1.Equals(w1));
        }
        public void testEquals()
        {
            AreEqual(weightA, weightB);

            IsTrue(weightA.Equals(weightB));
            IsTrue(weightB.Equals(weightA));
        }
Exemplo n.º 8
0
        public void TestEquals()
        {
            Weight d1 = new Weight(33, Weight.UnitType.Kg);
            Weight d2 = new Weight(33000, Weight.UnitType.G);

            Assert.IsTrue(d1.Equals(d2));
        }
 /// <summary>
 /// Checks if the other gene is the same connection as this gene.
 /// Takes into account:
 ///     The outID
 ///     The inID
 ///     The innovationNumber
 ///     The weight
 ///     Whether it is enabled
 /// </summary>
 /// <param name="other">The other connection gene.</param>
 /// <returns>Returns <c>true</c> if equals; otherwise, <c>false</c>.</returns>
 public bool Equals(ConnectionGene other)
 {
     return(other != null && InId == other.InId &&
            OutId == other.OutId &&
            InnovationNumber == other.InnovationNumber &&
            Weight.Equals(other.Weight) &&
            Enabled == other.Enabled);
 }
 /// <summary>
 /// Two DnsResourceDataServerSelection are equal iff their priority, weight, port and target fields are equal.
 /// </summary>
 public bool Equals(DnsResourceDataServerSelection other)
 {
     return(other != null &&
            Priority.Equals(other.Priority) &&
            Weight.Equals(other.Weight) &&
            Port.Equals(other.Port) &&
            Target.Equals(other.Target));
 }
Exemplo n.º 11
0
 public bool Equals(Client other)
 {
     return(base.Equals(other) &&
            ClientId.Equals(other.ClientId) &&
            Height.Equals(other.Height) &&
            Weight.Equals(other.Weight) &&
            MbesAttemptCount.Equals(other.MbesAttemptCount) &&
            MbesAllowAttempt == other.MbesAllowAttempt);
 }
        /// <summary>
        /// Indicates whether the current <see cref="DirectedWeightedEdge{TVertex}"/>
        /// is equal to another <see cref="DirectedWeightedEdge{TVertex}"/>.
        /// </summary>
        /// <param name="other">
        /// The <see cref="DirectedWeightedEdge{TVertex}"/> to compare with this
        /// object.
        /// </param>
        /// <returns>
        /// <see langword="true"/> if the other
        /// <see cref="DirectedWeightedEdge{TVertex}"/> is equal to this
        /// <see cref="DirectedWeightedEdge{TVertex}"/>; otherwise,
        /// <see langword="false"/>.
        /// </returns>
        /// <seealso cref="IEquatable{T}.Equals(T)"/>
        public bool Equals(DirectedWeightedEdge <TVertex> other)
        {
            if (other == null)
            {
                return(false);
            }

            return((SourceVertex.Equals(other.SourceVertex) && DestinationVertex.Equals(other.DestinationVertex)) &&
                   Weight.Equals(other.Weight));
        }
Exemplo n.º 13
0
        public void EqualsTest()
        {
            var    target   = new Weight(1, 1);
            object obj      = new Weight(1, 1);
            var    expected = true;
            bool   actual;

            actual = target.Equals(obj);
            Check.That(actual).IsEqualTo(expected);
        }
Exemplo n.º 14
0
            public void ZeroUnitsWeight_ShouldBeEqualToZeroKilograms()
            {
                // arrange
                var zeroKilogramsWeight = new Weight(Constants.Zero);
                var zeroUnitsWeight     = new Weight(Constants.Zero, CreateUnitOtherThan(WeightUnit.Kilogram));

                // act
                // assert
                zeroKilogramsWeight.Equals(zeroUnitsWeight).Should().BeTrue(because: "'new Weight(Constants.Zero)' should be equal 'new Weight(Constants.Zero, SomeUnit)'");
                zeroUnitsWeight.Equals(zeroKilogramsWeight).Should().BeTrue(because: "'new Weight(Constants.Zero, SomeUnit)' should be equal 'new Weight(Constants.Zero)'");
            }
Exemplo n.º 15
0
            public void WeightCreateUsingParamlessConstructor_ShouldBeEqualToZeroKilograms()
            {
                // arrange
                var zeroKilogramsWeight        = new Weight(Constants.Zero);
                var paramlessConstructedWeight = new Weight();

                // act
                // assert
                zeroKilogramsWeight.Equals(paramlessConstructedWeight).Should().BeTrue(because: "'new Weight(Constants.Zero)' should be equal 'new Weight()'");
                paramlessConstructedWeight.Equals(zeroKilogramsWeight).Should().BeTrue(because: "'new Weight()' should be equal 'new Weight(Constants.Zero)'");
            }
Exemplo n.º 16
0
        public override bool Equals(object obj)
        {
            Edge compareTo = obj as Edge;

            if (compareTo == null)
            {
                return(false);
            }

            return(Start.Equals(compareTo.Start) && End.Equals(compareTo.End) && Weight.Equals(compareTo.Weight));
        }
Exemplo n.º 17
0
            public void DefaultWeight_ShouldBeEqualToZeroKilograms()
            {
                // arrange
                var defaultWeight       = default(Weight);
                var zeroKilogramsWeight = new Weight(Constants.Zero);

                // act
                // assert
                zeroKilogramsWeight.Equals(defaultWeight).Should().BeTrue(because: "'new Weight(Constants.Zero)' should be equal 'default(Weight)'");
                defaultWeight.Equals(zeroKilogramsWeight).Should().BeTrue(because: "'default(Weight)' should be equal 'new Weight(Constants.Zero)'");
            }
        public void Equals_DoesNullComparison_ReturnsFalse()
        {
            // Arrange
            var weight = new Weight(5);

            // Act
            var actual = weight.Equals(null);

            // Assert
            Assert.False(actual);
        }
Exemplo n.º 19
0
            public void WeightsConvertedToDifferentUnitsEqualInKilograms_ShouldBeEqual()
            {
                // arrange
                var weight1 = new Weight(Fixture.Create <number>()).Convert(Fixture.Create <WeightUnit>());
                var weight2 = new Weight(weight1.Kilograms).Convert(CreateUnitOtherThan(weight1.Unit));

                // act
                bool equalsResult = weight1.Equals(weight2);

                // assert
                equalsResult.Should().BeTrue();
            }
Exemplo n.º 20
0
 public bool Equals(BodyPart other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(string.Equals(Name, other.Name) && Weight.Equals(other.Weight) && ControversialLevel == other.ControversialLevel && Equals(Manip, other.Manip));
 }
Exemplo n.º 21
0
        /// <summary>
        /// Returns true if DetailedAthlete instances are equal
        /// </summary>
        /// <param name="other">Instance of DetailedAthlete to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DetailedAthlete other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FollowerCount == other.FollowerCount ||
                     FollowerCount != null &&
                     FollowerCount.Equals(other.FollowerCount)
                     ) &&
                 (
                     FriendCount == other.FriendCount ||
                     FriendCount != null &&
                     FriendCount.Equals(other.FriendCount)
                 ) &&
                 (
                     MeasurementPreference == other.MeasurementPreference ||
                     MeasurementPreference != null &&
                     MeasurementPreference.Equals(other.MeasurementPreference)
                 ) &&
                 (
                     Ftp == other.Ftp ||
                     Ftp != null &&
                     Ftp.Equals(other.Ftp)
                 ) &&
                 (
                     Weight == other.Weight ||
                     Weight != null &&
                     Weight.Equals(other.Weight)
                 ) &&
                 (
                     Clubs == other.Clubs ||
                     Clubs != null &&
                     Clubs.SequenceEqual(other.Clubs)
                 ) &&
                 (
                     Bikes == other.Bikes ||
                     Bikes != null &&
                     Bikes.SequenceEqual(other.Bikes)
                 ) &&
                 (
                     Shoes == other.Shoes ||
                     Shoes != null &&
                     Shoes.SequenceEqual(other.Shoes)
                 ));
        }
Exemplo n.º 22
0
        /*#region IPathfindingNode Members
         *
         * public IPathfindingEdge JoiningEdge(GridTile node)
         * {
         *  throw new NotImplementedException();
         * }
         *
         #endregion*/

        #region IEquatable<GridEdge> Members

        public bool Equals(GridEdge other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            return(Motility.Equals(other.Motility) && Weight.Equals(other.Weight) && Location.Equals(other.Location));
        }
Exemplo n.º 23
0
 /// <summary>
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(Gradient other)
 {
     return(PaletteBailout.Equals(other.PaletteBailout) &&
            MaxIterationColor == other.MaxIterationColor &&
            PaletteScale.Equals(other.PaletteScale) &&
            Shift.Equals(other.Shift) &&
            LogIndex == other.LogIndex &&
            RootIndex == other.RootIndex &&
            Root.Equals(other.Root) &&
            MinIterations == other.MinIterations &&
            IndexScale.Equals(other.IndexScale) &&
            Weight.Equals(other.Weight));
 }
Exemplo n.º 24
0
 public bool Equals(Edge <TVertex> other)
 {
     if (other == null)
     {
         return(false);
     }
     else
     {
         bool vertices_equal = Source.Equals(other.Source) && Destination.Equals(other.Destination);
         bool weights_equal  = Weight.Equals(other.Weight);
         return(vertices_equal && weights_equal);
     }
 }
Exemplo n.º 25
0
        private void MetaRemoveIngredientsAndStatistics(int mealId, int productId, Meal modMeal)
        {
            Weight = mealProductData.FindWeight(mealId, productId);

            MealProduct = mealProductData.GetByIds(mealId, productId);

            if (!Weight.Equals(null))
            {
                Weight *= -1;
            }
            Meal = mealData.Recomposite(modMeal, Product, Weight);
            Meal.Products.Remove(Product);
            Meal.MealProducts.Remove(MealProduct);
        }
Exemplo n.º 26
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return(false);
            }
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }

            var coin = obj as Coin;

            return(coin != null && Weight.Equals(coin.Weight) && Value.Equals(coin.Value));
        }
Exemplo n.º 27
0
        /// <summary>
        /// Indicates whether the current <see cref="UndirectedWeightedEdge{TVertex}"/>
        /// is equal to another <see cref="UndirectedWeightedEdge{TVertex}"/>.
        /// </summary>
        /// <param name="other">
        /// The <see cref="UndirectedWeightedEdge{TVertex}"/> to compare with this
        /// object.
        /// </param>
        /// <returns>
        /// <see langword="true"/> if the other
        /// <see cref="UndirectedWeightedEdge{TVertex}"/> is equal to this
        /// <see cref="UndirectedWeightedEdge{TVertex}"/>; otherwise,
        /// <see langword="false"/>.
        /// </returns>
        /// <seealso cref="IEquatable{T}.Equals(T)"/>
        public bool Equals(UndirectedWeightedEdge <TVertex> other)
        {
            if (other == null)
            {
                return(false);
            }

            bool sameVerticesSameOrder =
                Vertex1.Equals(other.Vertex1) && Vertex2.Equals(other.Vertex2);

            bool sameVerticesDifferentOrder =
                Vertex1.Equals(other.Vertex2) && Vertex2.Equals(other.Vertex1);

            return((sameVerticesSameOrder || sameVerticesDifferentOrder) &&
                   Weight.Equals(other.Weight));
        }
Exemplo n.º 28
0
        public bool Equals(Patient other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(FirstName == other.FirstName && LastName == other.LastName && Id == other.Id &&
                   Gender == other.Gender && Age.Equals(other.Age) && Height.Equals(other.Height) &&
                   Weight.Equals(other.Weight) && ExamDate.EqualsUpToMilliseconds(other.ExamDate));
        }
Exemplo n.º 29
0
        /// <inheritdoc/>
        public bool Equals(CaseEntity other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Type == other.Type &&
                   MaxMotherboardSize == other.MaxMotherboardSize &&
                   Material == other.Material &&
                   WindowMaterial == other.WindowMaterial &&
                   TransparentWindow == other.TransparentWindow &&
                   Color == other.Color &&
                   Depth == (other.Depth ?? 0) &&
                   Width == (other.Width ?? 0) &&
                   Height == (other.Height ?? 0) &&
                   Weight.Equals(other.Weight ?? 0));
        }
Exemplo n.º 30
0
        /// <summary>
        /// Returns true if Product instances are equal
        /// </summary>
        /// <param name="other">Instance of Product to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Product other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ProductId == other.ProductId ||
                     ProductId != null &&
                     ProductId.Equals(other.ProductId)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ProductNumber == other.ProductNumber ||
                     ProductNumber != null &&
                     ProductNumber.Equals(other.ProductNumber)
                 ) &&
                 (
                     Color == other.Color ||
                     Color != null &&
                     Color.Equals(other.Color)
                 ) &&
                 (
                     StandardCost == other.StandardCost ||
                     StandardCost != null &&
                     StandardCost.Equals(other.StandardCost)
                 ) &&
                 (
                     ListPrice == other.ListPrice ||
                     ListPrice != null &&
                     ListPrice.Equals(other.ListPrice)
                 ) &&
                 (
                     Size == other.Size ||
                     Size != null &&
                     Size.Equals(other.Size)
                 ) &&
                 (
                     Weight == other.Weight ||
                     Weight != null &&
                     Weight.Equals(other.Weight)
                 ) &&
                 (
                     ProductLine == other.ProductLine ||
                     ProductLine != null &&
                     ProductLine.Equals(other.ProductLine)
                 ) &&
                 (
                     Class == other.Class ||
                     Class != null &&
                     Class.Equals(other.Class)
                 ) &&
                 (
                     Style == other.Style ||
                     Style != null &&
                     Style.Equals(other.Style)
                 ) &&
                 (
                     SubCategory == other.SubCategory ||
                     SubCategory != null &&
                     SubCategory.Equals(other.SubCategory)
                 ) &&
                 (
                     Model == other.Model ||
                     Model != null &&
                     Model.Equals(other.Model)
                 ) &&
                 (
                     Photo == other.Photo ||
                     Photo != null &&
                     Photo.Equals(other.Photo)
                 ) &&
                 (
                     Review == other.Review ||
                     Review != null &&
                     Review.SequenceEqual(other.Review)
                 ));
        }
Exemplo n.º 31
0
 public bool Equals(Edge e)
 {
     return(Start.Equals(e.Start) && End.Equals(e.End) && Weight.Equals(e.Weight));
 }