public void GivenFirstNameGetFirstNameMatches() { string value = "Jim"; Player player = new Player(); player.FirstName = value; Assert.Equal(value, player.FirstName); }
public void GivenOnlyFirstNameFullNameHasNoTrailingSpace() { string firstName = "Jim"; Player player = new Player(); player.FirstName = firstName; Assert.Equal(firstName, player.FullName); }
public void GivenOnlyLastNameFullNameHasNoLeadingSpace() { string lastName = "Reynolds"; Player player = new Player(); player.LastName = lastName; Assert.Equal(lastName, player.FullName); }
public void GivenLastNameGetLastNameMatches() { string value = "Reynolds"; Player player = new Player(); player.LastName = value; Assert.Equal(value, player.LastName); }
public void GiveFirstAndLastNameGetFullNameMatches(string firstName, string lastName) { string fullName = firstName + " " + lastName; Player player = new Player(); player.FirstName = firstName; player.LastName = lastName; Assert.Equal(fullName, player.FullName); }
public void GivenPartialFullNameItGoesIntoFirstName() { string fullName = "Fred"; Player player = new Player(); player.FullName = fullName; Assert.Equal(fullName, player.FirstName); Assert.Equal("", player.LastName); Assert.Equal(fullName, player.FullName); }
public static Player AddPlayer(string name, Location location) { Player player = new Player(); player.FullName = name; player.HomeLocationId = location.ID; playersDb.Players.Add(player); playersDb.SaveChanges(); Console.WriteLine("Player added: {0}", player.FullName); return player; }
public void GivenFullNameGetFirstLastAndFullNameMatches() { string firstName = "Jimmy"; string lastName = "Johnson"; string fullName = firstName + " " + lastName; Player player = new Player(); player.FullName = fullName; Assert.Equal(firstName, player.FirstName); Assert.Equal(lastName, player.LastName); Assert.Equal(fullName, player.FullName); }
public void GivenFullNameWithMultipleBlanksAllExtrasGoInLastName() { string firstName = "Jimmy"; string lastName = "Johnson (Queen City Red)"; string fullName = firstName + " " + lastName; Player player = new Player(); player.FullName = fullName; Assert.Equal(firstName, player.FirstName); Assert.Equal(lastName, player.LastName); Assert.Equal(fullName, player.FullName); }
public void GivenNewPlayerNamesAreNotNull() { Player player = new Player(); Assert.NotNull(player.FirstName); Assert.NotNull(player.LastName); }
public void GivenNoNameFullNameIsEmpty() { Player player = new Player(); Assert.Equal("", player.FullName); }
public static Player FindPlayer(string name) { name = name.ToUpper(); if (PlayerMap.ContainsKey(name)) name = PlayerMap[name]; var players = from player in db.Players where name == player.FirstName.ToUpper() + " " + player.LastName.ToUpper() select player; if (players.Count() != 1) players = from player in db.Players where name == player.FirstName.ToUpper() && name == player.LastName.ToUpper() select player; if (players.Count() == 0) { //Console.Write(String.Format("\nPlayer '{0}' not found. Create new player (y/n)? ", name)); //var key = Console.ReadKey(); //Console.WriteLine(); //if (key.KeyChar != 'y') // throw new ApplicationException(String.Format("Player '{0}' not found.", name)); Player player = new Player(); player.FullName = name; //db.Players.Add(player); return player; } return players.First(); }