コード例 #1
0
        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);
        }
コード例 #2
0
 public void A_name_given()
 {
     Assert.Equal("One for Alice, one for me.", TwoFer.Speak("Alice"));
 }
コード例 #3
0
 public void No_name_given() => Assert.Equal("One for you, one for me.", TwoFer.Name());
コード例 #4
0
 public void Another_name_given() => Assert.Equal("One for Bob, one for me.", TwoFer.Name("Bob"));
コード例 #5
0
 public void A_name_given() => Assert.Equal("One for Alice, one for me.", TwoFer.Name("Alice"));
コード例 #6
0
ファイル: TwoFerTest.cs プロジェクト: bkarvelas/exercism
 public void Give_empty_string_as_an_input()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Name(""));
 }
コード例 #7
0
ファイル: TwoFerTest.cs プロジェクト: bkarvelas/exercism
 public void Give_spaces_as_an_input()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Name("   "));
 }
コード例 #8
0
 public void GetDisplayText_NoNameGiven_IsForYou()
 {
     Assert.AreEqual("One for you, one for me.", TwoFer.GetDisplayText());
 }
コード例 #9
0
 public void Null_name_given()
 {
     Assert.Equal("One for null, one for me.", TwoFer.Name("null"));
 }
コード例 #10
0
ファイル: TwoFer.cs プロジェクト: mikedamay/Exercism
 public void TestOne()
 {
     Assert.True(TwoFer.AreEqual());
 }
コード例 #11
0
ファイル: TwoFerTest.cs プロジェクト: syhndie/ExercismCSharp
 public void Blank_name_given()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Name(""));
 }
コード例 #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;
            }
            }
        }
コード例 #13
0
 public void Whitespace_name_given()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Speak("   "));
 }
コード例 #14
0
 public void Name_with_postfix_whitespace_given()
 {
     Assert.Equal("One for Bob, one for me.", TwoFer.Speak("Bob   "));
 }
コード例 #15
0
 public void Another_name_given()
 {
     Assert.Equal("One for Bob, one for me.", TwoFer.Speak("Bob"));
 }
コード例 #16
0
 public void Another_no_name_given()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Name());
 }
コード例 #17
0
 public void No_name_given()
 {
     Assert.Equal("One for you, one for me.", TwoFer.Speak());
 }
コード例 #18
0
 public void GetDisplayText_ANameIsGiven_IsForName(string name)
 {
     Assert.AreEqual($"One for {name}, one for me.", TwoFer.GetDisplayText(name));
 }