コード例 #1
0
 public void Welcome_WhenWelcomingAMaleNoble_ShouldSayHelloSirLastName()
 {
     // Arrange
     GoodHost host = new GoodHost();
     Guest maleCommoner = new Guest { Name = "Arthur Lancelot", Gender = Gender.Male, Status = Status.Noble };
     // Act
     var greeting = host.Welcome(maleCommoner);
     // Assert
     Assert.AreEqual(expected: "Hello Sir Lancelot", actual: greeting);
 }
コード例 #2
0
 public void Welcome_WhenWelcomingAMaleCommoner_ShouldSayHelloMrLastName()
 {
     // Arrange
     GoodHost host = new GoodHost();
     Guest maleCommoner = new Guest { Name = "John Doe", Gender = Gender.Male, Status = Status.Commoner};
     // Act
     var greeting = host.Welcome(maleCommoner);
     // Assert
     Assert.AreEqual(expected: "Hello Mr. Doe", actual: greeting);
 }
コード例 #3
0
 public void Welcome_WhenWelcomingAFemaleCommoner_ShouldSayHelloMsLastName()
 {
     // Arrange
     GoodHost host = new GoodHost();
     Guest femaleCommoner = new Guest {Name = "Silvia Williams", Gender = Gender.Female, Status = Status.Commoner};
     // Act
     var greeting = host.Welcome(femaleCommoner);
     // Assert
     Assert.AreEqual(expected: "Hello Ms. Williams", actual: greeting);
 }
コード例 #4
0
 public void Welcome_WhenWelcomingAFemaleNoble_ShouldSayHelloLadyLastName()
 {
     // Arrange
     GoodHost host = new GoodHost();
     Guest femaleNoble = new Guest {Name = "Laura Fitzpatrick", Gender = Gender.Female, Status = Status.Noble};
     // Act
     var greeting = host.Welcome(femaleNoble);
     // Assert
     Assert.AreEqual(expected: "Hello Lady Fitzpatrick", actual: greeting);
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: Vintharas/Coding-Katas
        static void Main(string[] args)
        {
            var guests = new List<Guest>
                             {
                                 new Guest { Name = "Arthur McAdams", Gender = Gender.Male, Status = Status.Noble},
                                 new Guest { Name = "Charlie Sheen", Gender = Gender.Male, Status = Status.Commoner},
                                 new Guest { Name = "Bridgitte Ericsson", Gender = Gender.Female, Status = Status.Commoner},
                                 new Guest { Name = "Jane", Gender = Gender.Female, Status = Status.Noble}
                             };
            var host = new GoodHost();

            Console.WriteLine("The people starts arriving to the party, and the good host attends to his guests: ");
            foreach (var guest in guests)
                Console.WriteLine(host.Welcome(guest));
            Console.WriteLine("Now that everybody here, let the party begin!");
        }