Ejemplo n.º 1
0
        public void Reverse()
        {
            IMonoAlphabeticSettings settings = new MonoAlphabeticSettings();

            settings['A'] = 'B';
            Assert.Equal('A', settings.Reverse('B'));
        }
Ejemplo n.º 2
0
        public void CtorEmpty()
        {
            IMonoAlphabeticSettings settings = new MonoAlphabeticSettings();

            Assert.Equal("ABCDEFGHIJKLMNOPQRSTUVWXYZ", settings.CharacterSet);
            Assert.Equal(0, settings.SubstitutionCount);
            Assert.Equal("ABCDEFGHIJKLMNOPQRSTUVWXYZ", settings.Substitutions);
        }
Ejemplo n.º 3
0
        public void GetSubstitutionsInvalid(string characterSet, string substitutions, char from, char to)
        {
            IMonoAlphabeticSettings settings = new MonoAlphabeticSettings()
            {
                CharacterSet = characterSet, Substitutions = substitutions
            };

            Assert.Throws <ArgumentException>("value", () => settings[from] = to);
        }
Ejemplo n.º 4
0
        public void GetSubstitutionsValid(string characterSet, string substitutions, char from, char to)
        {
            IMonoAlphabeticSettings settings = new MonoAlphabeticSettings()
            {
                CharacterSet = characterSet, Substitutions = substitutions
            };

            settings[from] = to;

            Assert.Equal(to, settings[from]);
        }
Ejemplo n.º 5
0
        public void CtorSettings(string characterSet, string substitutions, int substitutionCount)
        {
            IMonoAlphabeticSettings settings = new MonoAlphabeticSettings()
            {
                CharacterSet = characterSet, Substitutions = substitutions
            };

            Assert.Equal(characterSet, settings.CharacterSet);
            Assert.Equal(substitutionCount, settings.SubstitutionCount);
            Assert.Equal(substitutions, settings.Substitutions);
        }
Ejemplo n.º 6
0
        public void SetSubstitutionInvalid(string characterSet, string substitutions, char from, char to, int substitutionCount)
        {
            IMonoAlphabeticSettings settings = new MonoAlphabeticSettings()
            {
                CharacterSet = characterSet, Substitutions = substitutions
            };

            Assert.Throws <ArgumentException>("value", () => settings[from] = to);
            Assert.Equal(substitutionCount, settings.SubstitutionCount);
            Assert.Equal(substitutions, settings.Substitutions);
        }
Ejemplo n.º 7
0
        public void SetSubstitutionChange(string characterSet, string substitutions, char from, char to, string newSubstitutions, int substitutionCount)
        {
            IMonoAlphabeticSettings settings = new MonoAlphabeticSettings()
            {
                CharacterSet = characterSet, Substitutions = substitutions
            };

            settings[from] = to;

            Assert.Equal(to, settings[from]);
            Assert.Equal(newSubstitutions, settings.Substitutions);
            Assert.Equal(substitutionCount, settings.SubstitutionCount);
        }
Ejemplo n.º 8
0
        public void ReverseInvalid()
        {
            IMonoAlphabeticSettings settings = new MonoAlphabeticSettings();

            Assert.Equal('a', settings.Reverse('a'));
        }