Exemple #1
0
 public AdjacentRoomsGeneratorConfiguration(
     int iterations,
     int surroundingIterations,
     ConstraintRange <int> roomWidthRange,
     ConstraintRange <int> roomHeightRange)
 {
     Iterations            = iterations;
     SurroundingIterations = surroundingIterations;
     this.RoomWidthRange   = roomWidthRange;
     this.RoomHeightRange  = roomHeightRange;
 }
Exemple #2
0
        public void DefaultContructor_EmptyObject_EmptyProperties()
        {
            //Arrange
            var sut = new ConstraintRange <int>();

            //Act
            var(min, max) = sut;

            //Assert
            Assert.Equal(0, min);
            Assert.Equal(0, max);
        }
Exemple #3
0
        public void Contructor_ValidObject_ValidProperties()
        {
            //Arrange
            var sut = new ConstraintRange <int>(-4, 5);

            //Act
            var(min, max) = sut;

            //Assert
            Assert.Equal(-4, min);
            Assert.Equal(5, max);
        }
Exemple #4
0
        public void Equals_TwoObjectsWithDifferentProperties_False()
        {
            //Arrange
            var sut1 = new ConstraintRange <int>(-4, 5);
            var sut2 = new ConstraintRange <int>(3, 5);

            //Act
            var result1 = sut1.Equals(sut2);
            var result2 = sut2.Equals(sut1);

            //Assert
            Assert.False(result1);
            Assert.False(result2);
        }
Exemple #5
0
        public void Equals_TwoObjectsWithTheSameProperties_True()
        {
            //Arrange
            var sut1 = new ConstraintRange <int>(-4, 5);
            var sut2 = new ConstraintRange <int>(-4, 5);

            //Act
            var result1 = sut1.Equals(sut2);
            var result2 = sut2.Equals(sut1);

            //Assert
            Assert.True(result1);
            Assert.True(result2);
        }
Exemple #6
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Label != null)
                {
                    hashCode = hashCode * 59 + Label.GetHashCode();
                }

                if (TickVals != null)
                {
                    hashCode = hashCode * 59 + TickVals.GetHashCode();
                }

                if (TickText != null)
                {
                    hashCode = hashCode * 59 + TickText.GetHashCode();
                }

                if (TickFormat != null)
                {
                    hashCode = hashCode * 59 + TickFormat.GetHashCode();
                }

                if (Visible != null)
                {
                    hashCode = hashCode * 59 + Visible.GetHashCode();
                }

                if (Range != null)
                {
                    hashCode = hashCode * 59 + Range.GetHashCode();
                }

                if (ConstraintRange != null)
                {
                    hashCode = hashCode * 59 + ConstraintRange.GetHashCode();
                }

                if (MultiSelect != null)
                {
                    hashCode = hashCode * 59 + MultiSelect.GetHashCode();
                }

                if (Values != null)
                {
                    hashCode = hashCode * 59 + Values.GetHashCode();
                }

                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }

                if (TemplateItemName != null)
                {
                    hashCode = hashCode * 59 + TemplateItemName.GetHashCode();
                }

                if (TickValsSrc != null)
                {
                    hashCode = hashCode * 59 + TickValsSrc.GetHashCode();
                }

                if (TickTextSrc != null)
                {
                    hashCode = hashCode * 59 + TickTextSrc.GetHashCode();
                }

                if (ValuesSrc != null)
                {
                    hashCode = hashCode * 59 + ValuesSrc.GetHashCode();
                }

                return(hashCode);
            }
        }
Exemple #7
0
        public bool Equals([AllowNull] Dimension other)
        {
            if (other == null)
            {
                return(false);
            }

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

            return((Label == other.Label && Label != null && other.Label != null && Label.Equals(other.Label)) &&
                   (Equals(TickVals, other.TickVals) || TickVals != null && other.TickVals != null && TickVals.SequenceEqual(other.TickVals)) &&
                   (Equals(TickText, other.TickText) || TickText != null && other.TickText != null && TickText.SequenceEqual(other.TickText)) &&
                   (TickFormat == other.TickFormat && TickFormat != null && other.TickFormat != null && TickFormat.Equals(other.TickFormat)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (Equals(Range, other.Range) || Range != null && other.Range != null && Range.SequenceEqual(other.Range)) &&
                   (Equals(ConstraintRange, other.ConstraintRange) || ConstraintRange != null && other.ConstraintRange != null && ConstraintRange.SequenceEqual(other.ConstraintRange)) &&
                   (MultiSelect == other.MultiSelect && MultiSelect != null && other.MultiSelect != null && MultiSelect.Equals(other.MultiSelect)) &&
                   (Equals(Values, other.Values) || Values != null && other.Values != null && Values.SequenceEqual(other.Values)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (TemplateItemName == other.TemplateItemName && TemplateItemName != null && other.TemplateItemName != null && TemplateItemName.Equals(other.TemplateItemName)) &&
                   (TickValsSrc == other.TickValsSrc && TickValsSrc != null && other.TickValsSrc != null && TickValsSrc.Equals(other.TickValsSrc)) &&
                   (TickTextSrc == other.TickTextSrc && TickTextSrc != null && other.TickTextSrc != null && TickTextSrc.Equals(other.TickTextSrc)) &&
                   (ValuesSrc == other.ValuesSrc && ValuesSrc != null && other.ValuesSrc != null && ValuesSrc.Equals(other.ValuesSrc)));
        }