예제 #1
0
        /// <summary>
        /// Initialize a new chareable device with a given internal adapter
        /// </summary>
        /// <param name="internalAdapter">The internal adapter to use</param>
        public ChargeableDevice(IChargeableDevice internalAdapter)
        {
            if (internalAdapter == null)
            {
                throw new ArgumentException("The internal adapter cannot be null", nameof(internalAdapter));
            }

            _internalAdapter = internalAdapter;
        }
예제 #2
0
        public void Constructor_GivenValidChargeableDevice_SetsPropertiesAsExpected(IChargeableDevice device, int expectedLowInput, int expectedHighInput, IDictionary <int, bool> testSocketData)
        {
            var sut = new ChargeableDevice(device);

            Assert.Equal(expectedLowInput, sut.LowInput);
            Assert.Equal(expectedHighInput, sut.HighInput);
            foreach (var kvp in testSocketData)
            {
                var testSocket = MockSocket(kvp.Key);

                Assert.Equal(kvp.Value, sut.CanAttach(testSocket));
            }
        }