Ejemplo n.º 1
0
        public void VO_Equals()
        {
            var orderDetail = new OrderDetail {
                ProductId = 10, Cost = 100, Count = 2
            };

            orderDetail.Equals(new OrderDetail {
                ProductId = 10, Cost = 100, Count = 2
            }).ShouldBeTrue();
            new OrderDetail {
                ProductId = 10, Cost = 100, Count = 2
            }.Equals(new CertDetail {
                ProductId = 10, Cost = 100, Count = 2
            }).ShouldBeFalse();
            new OrderDetail {
                ProductId = 10, Cost = 100, Count = 2
            }.Equals(new OrderDetail {
                ProductId = 9, Cost = 100, Count = 2
            }).ShouldBeFalse();
            var empty = new Empty();

            empty.Equals(new Empty()).ShouldBeTrue();
            new Empty().Equals(null).ShouldBeFalse();
            new OrderDetail {
                ProductId = 10, Cost = 100, Count = 2
            }.GetHashCode().ShouldBe(23837272);
            new Order {
                Id = 10
            }.GetHashCode().ShouldBe(922);
        }
 protected virtual void DrawClearLayout()
 {
     if (ShowClear)
     {
         using (new EditorGUI.DisabledScope(Empty.Equals(Path)))
         {
             if (GUILayout.Button(delTex, GUILayout.Width(delTex.width + 10f)))
             {
                 Path = Empty;
             }
         }
     }
 }
 protected virtual void DrawClear(Rect rect)
 {
     if (ShowClear)
     {
         using (new EditorGUI.DisabledScope(Empty.Equals(Path)))
         {
             if (GUI.Button(rect, delTex))
             {
                 Path = Empty;
             }
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns true if Tile instances are equal
        /// </summary>
        /// <param name="other">Instance of Tile to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Tile other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Empty == other.Empty ||
                     Empty.Equals(other.Empty)
                 ) &&
                 (
                     Direction == other.Direction ||
                     Direction.Equals(other.Direction)
                 ) &&
                 (
                     RotatorDirection == other.RotatorDirection ||
                     RotatorDirection.Equals(other.RotatorDirection)
                 ) &&
                 (
                     Level == other.Level ||
                     Level.Equals(other.Level)
                 ) &&
                 (
                     Order == other.Order ||
                     Order.Equals(other.Order)
                 ));
        }
 public void ShouldConsiderAnEmptyAndNullNotEqual()
 {
     var first = new Empty();
     Assert.That(first.Equals(null), Is.False);
 }
 public void ShouldConsiderEmptyObjectsEqual()
 {
     var first = new Empty();
     var second = new Empty();
     Assert.That(first.Equals(second), Is.True);
 }
 public void ShouldConsiderAnEmptyAndAnotherTypeNotEqual()
 {
     var first = new Empty();
     var second = new object();
     Assert.That(first.Equals(second), Is.False);
 }