示例#1
0
        static void Run(string[] args)
        {
            ServiceCollection serviceCollection = new ServiceCollection();

            ConfigureServices(serviceCollection);

            string rawString = configuration.GetSection("text").Value.ToLower();

            IAlphabetMachine alphabetMachine = serviceProvider.GetService <IAlphabetMachine>();

            Alphabet tempAlphabet;

            // Create alphabet list
            foreach (char @char in rawString)
            {
                tempAlphabet = alphabetMachine.CreateAlphabet(@char);
                alphabetMachine.AddAlphabet(tempAlphabet);
            }

            // Get output string from alphabet list
            string outputString = alphabetMachine.GetOutPutString();

            Console.WriteLine($"Ouput: {outputString}");
        }
示例#2
0
 public AlphabetMachineTests()
 {
     this._machine = new AlphabetMachine();
 }