public void NumeralSystemAndGeneratorIntegrationTest_ThrowsArgumentException_Test()
        {
            //Assign
            var inputInBase13          = "0";
            var numeralSystemConverter = new NumeralSystemConverter();
            var primeNumberGenerator   = new PrimeNumberGeneratorNaive();
            //Act
            var inputInDecimal = numeralSystemConverter.ArbitraryToDecimalSystem(inputInBase13, 13);

            //Assert
            Assert.Throws <ArgumentException>(() => primeNumberGenerator.ExecuteWithYield(inputInDecimal));
        }
Exemple #2
0
        public void NumeralSystemConverter_Base13ToDecimal_Test()
        {
            //Assign
            var numeralSystemConverter = new NumeralSystemConverter();
            Dictionary <int, string> decimalBase13Set = new Dictionary <int, string>()
            {
                { 0, "0" }, { 1, "1" }, { 9, "9" }, { 10, "A" }, { 11, "B" }, { 12, "C" }, { 13, "10" }, { 14, "11" }, { 15, "12" }, { 16, "13" }
            };

            foreach (var decimalBase13Pair in decimalBase13Set)
            {
                //Act
                var result = numeralSystemConverter.ArbitraryToDecimalSystem(decimalBase13Pair.Value, 13);
                //Asert
                Assert.Equal(decimalBase13Pair.Key, result);
            }
        }