コード例 #1
0
        public void ShouldFindNextAdapterWhichCanConnect(int output, int expectedAdapter)
        {
            // Arrange
            var adapters = AdaptersInBag();

            // Act
            var rating = new AdapterBag(adapters).FindNextAdapter(output);

            // Assert
            rating.Should().Be(expectedAdapter);
        }
コード例 #2
0
        public void ShouldGetBuiltInAdapterRating()
        {
            // Arrange
            var adapters = AdaptersInBag();

            // Act
            var rating = new AdapterBag(adapters).GetBuiltInAdapterRate();


            // Assert
            rating.Should().Be(22);
        }
コード例 #3
0
        public void ShouldFindAdapterWhichCanConnectWith3JoltDifference()
        {
            // Arrange
            var adapters = new List <int>
            {
                16,
                3,
                15
            };

            // Act
            var rating = new AdapterBag(adapters).FindFirstMatchingAdapter(0);

            // Assert
            rating.Should().Be(3);
        }
コード例 #4
0
        public void ShouldFindAdapterWhichCanConnectDirectly()
        {
            // Arrange
            var adapters = new List <int>
            {
                16,
                1,
                15,
                0
            };

            // Act
            var rating = new AdapterBag(adapters).FindFirstMatchingAdapter(0);

            // Assert
            rating.Should().Be(0);
        }