public void TestProgram_Null()
        {
            // Arrange
            TwoFer twofer = new TwoFer();

            // Act
            string strResult = twofer.Operation(strName);

            // Assert
            Assert.AreEqual("One for you, one for me.", strResult);
        }
Example #2
0
 public void A_name_given()
 {
     Assert.Equal("One for Alice, one for me.", TwoFer.Speak("Alice"));
 }
Example #3
0
 public void No_name_given() => Assert.Equal("One for you, one for me.", TwoFer.Name());
Example #4
0
 public void Another_name_given() => Assert.Equal("One for Bob, one for me.", TwoFer.Name("Bob"));
Example #5
0
 public void A_name_given() => Assert.Equal("One for Alice, one for me.", TwoFer.Name("Alice"));
Example #6
0
 public void Give_empty_string_as_an_input()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Name(""));
 }
Example #7
0
 public void Give_spaces_as_an_input()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Name("   "));
 }
Example #8
0
 public void GetDisplayText_NoNameGiven_IsForYou()
 {
     Assert.AreEqual("One for you, one for me.", TwoFer.GetDisplayText());
 }
Example #9
0
 public void Null_name_given()
 {
     Assert.Equal("One for null, one for me.", TwoFer.Name("null"));
 }
Example #10
0
 public void TestOne()
 {
     Assert.True(TwoFer.AreEqual());
 }
Example #11
0
 public void Blank_name_given()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Name(""));
 }
Example #12
0
        private static void Main()
        {
menu:
            Console.WriteLine("Please enter your Choice of Programs: ");
            Console.WriteLine("1. Bob - The Assistant");
            Console.WriteLine("2. Matching brackets");
            Console.WriteLine("3. Two Fer");
            Console.WriteLine("4. Exit");
            int nChoice = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException());

            switch (nChoice)
            {
            case 1:
            {
                char bContinue;
                Bob  bob = new Bob();
                do
                {
                    Console.WriteLine("Enter the value of string: ");
                    string strPartner = Console.ReadLine();
                    string strBob     = bob.Conversation(strPartner);
                    Console.WriteLine(strBob);
                    Console.WriteLine("Do you wish to continue? y / n");
                    bContinue = char.Parse(Console.ReadLine() ?? throw new InvalidOperationException());
                } while(bContinue == 'y');

                goto menu;
            }

            case 2:
            {
                char     bContinue;
                Matching brackets = new Matching();
                do
                {
                    // can try with user defined string with braces.
                    Console.WriteLine("Please enter the Statement / Expression: ");
                    string strInput = Console.ReadLine();
                    bool   bResult  = brackets.QueryAnalysis(strInput);
                    Console.WriteLine(bResult);

                    /*strInput = "[testmethods{ curlybraces(paranthesis box) box}box]";
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine("The given string is : " + strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "[testmethods box]";
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine("The given string is : " + strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "{curlybraces(paranthesis box) box}";
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine("The given string is : " + strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "(paranthesis box)";
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine("The given string is : " + strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "testmethods{ curlybraces}box(paranthesis box)";
                     * Console.WriteLine("The given string is : " + strInput);
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "[testmethods]box{ curlybraces}bx(paranthesis box) boxbox";
                     * Console.WriteLine("The given string is : " + strInput);
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "[testmethods curlybraces(paranthesis box) boxbox]";
                     * Console.WriteLine("The given string is : " + strInput);
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "[testmethods }curlybraces(paranthesis box) boxbox]";
                     * Console.WriteLine("The given string is : " + strInput);
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "[testmethods{ curlybracesparanthesis box box}box]";
                     * Console.WriteLine("The given string is : " + strInput);
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "[testmethods{ curlybraces(paranthesis box box}box]";
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine("The given string is : " + strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "{testmethods[ curlybraces(paranthesis box box]box}";
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine("The given string is : " + strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "(testmethods[ curlybraces{paranthesis box box]box)";
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine("The given string is : " + strInput);
                     * Console.WriteLine(bResult);
                     * strInput = "testmethods[ curlybraces(paranthesis )box box]box}";
                     * bResult = brackets.QueryAnalysis(strInput);
                     * Console.WriteLine("The given string is : " + strInput);
                     * Console.WriteLine(bResult);*/
                    Console.WriteLine("Do you wish to continue? y / n");
                    bContinue = char.Parse(Console.ReadLine() ?? throw new InvalidOperationException());
                } while(bContinue == 'y');

                goto menu;
            }

            case 3:
            {
                char   bContinue;
                TwoFer p = new TwoFer();
                do
                {
                    Console.WriteLine("Enter the value of string: ");
                    string strName = Console.ReadLine();
                    string strRes  = p.Operation(strName);
                    Console.WriteLine(strRes);
                    Console.WriteLine("Do you wish to continue? y / n");
                    bContinue = char.Parse(Console.ReadLine() ?? throw new InvalidOperationException());
                } while(bContinue == 'y');

                goto menu;
            }

            case 4:
            {
                break;
            }

            default:
            {
                Console.WriteLine("Please give values between 1 / 2 / 3 / 4...");
                goto menu;
            }
            }
        }
Example #13
0
 public void Whitespace_name_given()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Speak("   "));
 }
Example #14
0
 public void Name_with_postfix_whitespace_given()
 {
     Assert.Equal("One for Bob, one for me.", TwoFer.Speak("Bob   "));
 }
Example #15
0
 public void Another_name_given()
 {
     Assert.Equal("One for Bob, one for me.", TwoFer.Speak("Bob"));
 }
Example #16
0
 public void Another_no_name_given()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Name());
 }
Example #17
0
 public void No_name_given()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Speak());
 }
Example #18
0
 public void GetDisplayText_ANameIsGiven_IsForName(string name)
 {
     Assert.AreEqual($"One for {name}, one for me.", TwoFer.GetDisplayText(name));
 }