Пример #1
0
        public void Initialize_Test()
        {
            var sut=new Hotel(3);
            sut.Initialize(11);

            Assert.That(sut.WireDirections[0], Is.EqualTo(2));
            Assert.That(sut.WireDirections[1], Is.EqualTo(0));
            Assert.That(sut.WireDirections[2], Is.EqualTo(1));
        }
Пример #2
0
        public void HasBlackOut_True_Test()
        {
            var sut = new Hotel(4);
            sut.WireDirections[0] = 1;
            sut.WireDirections[1] = 2;
            sut.WireDirections[2] = 3;
            sut.WireDirections[3] = 1;

            Assert.That(sut.HasBlackOut(), Is.True);
        }
Пример #3
0
        public void HasBlackOut_At_floor_Test()
        {
            var sut = new Hotel(3);
            sut.WireDirections[0] = 1;
            sut.WireDirections[1] = 0;
            sut.WireDirections[2] = 1;

            Assert.That(sut.HasBlackOut(0), Is.True);
            Assert.That(sut.HasBlackOut(1), Is.True);
            Assert.That(sut.HasBlackOut(2), Is.False);
        }
Пример #4
0
 public Hotel Clone()
 {
     Hotel clone = new Hotel(this.FloorNum);
     clone.WireDirections = (int[])this.WireDirections.Clone();
     return clone;
 }
Пример #5
0
 public static int GetSumMinChange(int floorNum)
 {
     int permutationNumber = (int)Math.Pow(floorNum, floorNum);
     int sum = 0;
     for (int i = 0; i < permutationNumber; i++)
     {
         var hotel = new Hotel(floorNum);
         hotel.Initialize(i);
         sum += hotel.GetMinimunChange();
     }
     return sum;
 }