Пример #1
0
        static void Main(string[] args)
        {
            Container       container       = new Container();
            CeasarDecryptor ceasarDecryptor = new CeasarDecryptor();
            TextService     textService     = new TextService();
            List <string>   textsToDecrypt  = new List <string>();
            List <Text>     texts           = new List <Text>();

            container.Options.ResolveUnregisteredConcreteTypes = true;
            container.Register <ITextService, TextService>();
            container.Verify();
            textService = container.GetInstance <TextService>();

            Task.Run(async() =>
            {
                texts          = await textService.GetTexts();
                textsToDecrypt = ceasarDecryptor.GetTexts(texts);
            });

            foreach (string text in textsToDecrypt)
            {
                for (int i = 0; i < 26; i++)
                {
                    Console.WriteLine(ceasarDecryptor.Decryptor(text, i));
                }
            }
            Console.ReadKey();
        }
Пример #2
0
        public void Decrypt_GivenString_WhenCalled()
        {
            string text   = "abcde";
            var    ceasar = new CeasarDecryptor();
            var    result = ceasar.Decryptor(text, 3);

            Assert.AreEqual("defgh", result);
        }