Exemplo n.º 1
0
 public void GivenFirstNameGetFirstNameMatches()
 {
     string value = "Jim";
     Player player = new Player();
     player.FirstName = value;
     Assert.Equal(value, player.FirstName);
 }
Exemplo n.º 2
0
 public void GivenOnlyFirstNameFullNameHasNoTrailingSpace()
 {
     string firstName = "Jim";
     Player player = new Player();
     player.FirstName = firstName;
     Assert.Equal(firstName, player.FullName);
 }
Exemplo n.º 3
0
 public void GivenOnlyLastNameFullNameHasNoLeadingSpace()
 {
     string lastName = "Reynolds";
     Player player = new Player();
     player.LastName = lastName;
     Assert.Equal(lastName, player.FullName);
 }
Exemplo n.º 4
0
 public void GivenLastNameGetLastNameMatches()
 {
     string value = "Reynolds";
     Player player = new Player();
     player.LastName = value;
     Assert.Equal(value, player.LastName);
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
		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;
		}
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
 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);
 }
Exemplo n.º 10
0
 public void GivenNewPlayerNamesAreNotNull()
 {
     Player player = new Player();
     Assert.NotNull(player.FirstName);
     Assert.NotNull(player.LastName);
 }
Exemplo n.º 11
0
 public void GivenNoNameFullNameIsEmpty()
 {
     Player player = new Player();
     Assert.Equal("", player.FullName);
 }
Exemplo n.º 12
0
		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();
		}