Exemplo n.º 1
0
        public void WhenIntergalacticUnitAlreadyRegistered_Throws()
        {
            var currencyDefinition = new SymbolDefinition();

            currencyDefinition.AddDefinition("glob", "I");
            Assert.Throws <ArgumentException>(
                () => currencyDefinition.AddDefinition("glob", "V"));
        }
Exemplo n.º 2
0
        public void WhenRomanNumeralValueAlreadyRegistered_Throws()
        {
            var currencyDefinition = new SymbolDefinition();

            currencyDefinition.AddDefinition("glob1", "I");
            Assert.Throws <ArgumentException>(
                () => currencyDefinition.AddDefinition("glob2", "I"));
        }
Exemplo n.º 3
0
        private static SymbolDefinition InitializeDefinitions()
        {
            var definitions = new SymbolDefinition();

            definitions.AddDefinition("glob", "I");
            definitions.AddDefinition("prok", "V");
            definitions.AddDefinition("pish", "X");
            definitions.AddDefinition("tegj", "L");

            return(definitions);
        }
Exemplo n.º 4
0
        public void WhenUnitDefinitionAdded_ConvertsToRoman()
        {
            var currencyDefinition = new SymbolDefinition();

            currencyDefinition.AddDefinition("glob", "I");

            Assert.AreEqual("I", currencyDefinition["glob"]);
        }
Exemplo n.º 5
0
        public void WhenUnitNotRegistered_Throws()
        {
            var currencyDefinition = new SymbolDefinition();

            currencyDefinition.AddDefinition("glob", "I");

            Assert.Throws <ArgumentException>(
                () => { var a = currencyDefinition["prok"]; });
        }
Exemplo n.º 6
0
        public void CoversAllSimpleRomanNumerals()
        {
            var currencyDefinition = new SymbolDefinition();

            currencyDefinition.AddDefinition("glob", "I");
            currencyDefinition.AddDefinition("prok", "V");
            currencyDefinition.AddDefinition("pish", "X");
            currencyDefinition.AddDefinition("tegj", "L");
            currencyDefinition.AddDefinition("asdf", "C");
            currencyDefinition.AddDefinition("zxcv", "D");
            currencyDefinition.AddDefinition("rfvb", "M");

            Assert.AreEqual("I", currencyDefinition["glob"]);
            Assert.AreEqual("V", currencyDefinition["prok"]);
            Assert.AreEqual("X", currencyDefinition["pish"]);
            Assert.AreEqual("L", currencyDefinition["tegj"]);
            Assert.AreEqual("C", currencyDefinition["asdf"]);
            Assert.AreEqual("D", currencyDefinition["zxcv"]);
            Assert.AreEqual("M", currencyDefinition["rfvb"]);
        }