コード例 #1
0
        public void ShouldReturnNoValuesForBadUpperBound()
        {
            ICustomerApi sut = new CustomerApi();

            var configDictionary = new Dictionary <int, string>();
            int upperBound       = 0;
            var actualValues     = sut.GetNumbers(upperBound, configDictionary);

            CollectionAssert.IsEmpty(actualValues);
        }
コード例 #2
0
        public void ShouldReturnNumberOfValuesEqualToUpperBound()
        {
            ICustomerApi sut = new CustomerApi();

            var configDictionary       = new Dictionary <int, string>();
            int expectedNumberOfValues = 100;

            int actualNumberOfValues = sut.GetNumbers(100, configDictionary).Count();

            Assert.That(actualNumberOfValues, Is.EqualTo(expectedNumberOfValues));
        }
コード例 #3
0
        public void ShouldPrintMultipleTriggerValuesForMatchingDivisors()
        {
            ICustomerApi sut = new CustomerApi();
            var          configDictionary = new Dictionary <int, string>()
            {
                { 3, "test1" },
                { 5, "test2" }
            };

            string expectedTriggerOutputValue = sut.GetNumbers(50, configDictionary).ToArray()[14];

            Assert.That(expectedTriggerOutputValue, Is.EqualTo("test1test2"));
        }
コード例 #4
0
        public void ShouldPrintTriggerValueForMatchingDivisors()
        {
            ICustomerApi sut = new CustomerApi();
            var          configDictionary = new Dictionary <int, string>()
            {
                { 3, "test" }
            };

            string[] outputFromSut = sut.GetNumbers(50, configDictionary).ToArray();
            string   expectedTriggerOutputValue1 = outputFromSut[2];
            string   expectedTriggerOutputValue2 = outputFromSut[8];

            Assert.That(expectedTriggerOutputValue1, Is.EqualTo("test"));
            Assert.That(expectedTriggerOutputValue2, Is.EqualTo("test"));
        }
コード例 #5
0
        static void Main(string[] args)
        {
            int upperBound = GetUpperBoundFromCustomer();

            WriteInstructionsToCustomer();

            var triggers = GetTriggersFromCustomer();

            ICustomerApi api = new CustomerApi();

            foreach (var x in api.GetNumbers(upperBound, triggers))
            {
                Console.WriteLine(x);
            }

            WriteEndInstructionsToCustomer();

            Console.ReadKey();
        }