Пример #1
0
        public void Encoder_HashesStringCorrectly(string toEncode, string expected)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();
            // Arrange
            // this can be pass as test function input and that way we use maximum loosly couple
            Dictionary <char, char> _letterDictinary = new Dictionary <char, char>()
            {
                { 'a', '1' },
                { 'e', '2' },
                { 'i', '3' },
                { 'o', '4' },
                { 'u', '5' },
                { 'y', ' ' },
                { ' ', 'y' }
            };
            var myEncoderProcessor = new EncoderProcessor(_letterDictinary);

            //execute
            Assert.Equal(expected, myEncoderProcessor.Encode(toEncode));
            stopWatch.Stop();
            Console.WriteLine("Memory (MB): " + (GC.GetTotalMemory(false) * 0.000001));
            Console.WriteLine("Runtime: " + stopWatch.ElapsedMilliseconds + "ms");
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the string ");
            string           inputString = Console.ReadLine();
            EncoderProcessor encode      = new EncoderProcessor();

            encode.Encode(inputString);
        }