示例#1
0
		public static async Task Test_Retrieve_Characters_By_Account_Id_Works(params string[] names)
		{
			//arrange
			ICharacterRepository repository = BuildEmptyRepository();

			//act: Add all to the same account key
			foreach(string n in names)
				await repository.TryCreateAsync(new CharacterEntryModel(1, n));

			//Add another not associated with the first id
			await repository.TryCreateAsync(new CharacterEntryModel(2, Guid.NewGuid().ToString()));

			int[] result = await repository.CharacterIdsForAccountId(1);

			//assert
			Assert.AreEqual(names.Length, result.Length, $"Expected character id collection length to be the same count as names.");
			foreach(int key in result)
				Assert.True(names.Contains((await repository.RetrieveAsync(key)).CharacterName));
		}