Esempio n. 1
0
        public void GetToken()
        {
            var client   = new RedPillService.RedPillClient("BasicHttpBinding_IRedPill1");
            var response = client.WhatIsYourToken();

            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.ToString()));
        }
Esempio n. 2
0
        public void FibonacciNumber()
        {
            var readifyClient = new RedPillClient("BasicHttpBinding_IRedPill");
            var redPillClient = new RedPillService.RedPillClient("BasicHttpBinding_IRedPill1");

            long[] numbers          = { -4, -5, 0, 1, -6, 3, 4, 5, 6, 7, 46, 47, 92, 2, -3, -1, -92, -47, -46, -7, -93, 93, -9223372036854775808, -2147483648, 2147483647, 9223372036854775807 };
            var    exceptionOccured = false;

            foreach (var number in numbers)
            {
                long readifyResult = 0;
                long redPillResult = 0;
                try
                {
                    readifyResult = readifyClient.FibonacciNumber(number);
                }
                catch { }
                try
                {
                    redPillResult = redPillClient.FibonacciNumber(number);
                }
                catch {}
                if (readifyResult != redPillResult)
                {
                    exceptionOccured = true;
                }
            }
            Assert.IsFalse(exceptionOccured);
        }
Esempio n. 3
0
        public void ReverseWords()
        {
            var readifyClient = new RedPillClient("BasicHttpBinding_IRedPill");
            var redPillClient = new RedPillService.RedPillClient("BasicHttpBinding_IRedPill1");

            string[] words = { "", "cat", "trailing space ", "Bang!", "", "cat and dog", "two  spaces", " leading space", "Capital", "This is a snark: ⸮", "P!u@n#c$t%u^a&t*i(o)n", "detartrated kayak detartrated", "¿Qué?", "  S  P  A  C  E  Y  ", "!B!A!N!G!S!" };
            foreach (var word in words)
            {
                var readifyResult = readifyClient.ReverseWords(word);
                var redPillResult = redPillClient.ReverseWords(word);

                Assert.AreEqual(readifyResult, redPillResult);
            }
        }
Esempio n. 4
0
        public void WhatShapeIsThis()
        {
            var readifyClient = new RedPillClient("BasicHttpBinding_IRedPill");
            var redPillClient = new RedPillService.RedPillClient("BasicHttpBinding_IRedPill1");

            int[] a = { 0, 1, 1, 1, 2, 1, 1, 1, 2, 2147483647, 2, 2, 3, 2, 3, 4, 4, 1, -2147483648, -1, -1, 1, 1, 0, 2147483647 };
            int[] b = { 0, 1, 1, 0, 1, 2, 1, 1, 2, 2147483647, 2, 3, 2, 3, 4, 2, 3, 2, -2147483648, -1, 1, -1, 1, 1, 2147483647 };
            int[] c = { 0, 0, 2, 1, 1, 3, 2147483647, 1, 2, 2147483647, 3, 2, 2, 4, 2, 3, 2, 1, -2147483648, -1, 1, 1, -1, 1, 2147483647 };
            if (a.Length == b.Length && b.Length == c.Length)
            {
                for (int i = 0; i < a.Length; i++)
                {
                    var readifyResult = readifyClient.WhatShapeIsThis(a[i], b[i], c[i]);
                    var redPillResult = redPillClient.WhatShapeIsThis(a[i], b[i], c[i]);

                    Assert.AreEqual(readifyResult.ToString("G"), redPillResult.ToString("G"));
                }
            }
        }