public async Task Test_Can_Create_Character(string name) { //arrange IServiceProvider serviceProvider = BuildServiceProvider <CharacterController>("Test", 1); CharacterController controller = serviceProvider.GetService <CharacterController>(); //act CharacterCreationResponse result = ControllerTestsHelpers.GetActionResultObject <CharacterCreationResponse>(await controller.CreateCharacter(name)); //assert Assert.True(result.isSuccessful); Assert.True(result.ResultCode == CharacterCreationResponseCode.Success); }
public async Task Test_Cannot_Create_Character_With_Duplicate_Name(string name) { //arrange IServiceProvider serviceProvider = BuildServiceProvider <CharacterController>("Test", 1); CharacterController controller = serviceProvider.GetService <CharacterController>(); //act await controller.CreateCharacter(name); CharacterCreationResponse result = ControllerTestsHelpers.GetActionResultObject <CharacterCreationResponse>(await controller.CreateCharacter(name)); //assert Assert.False(result.isSuccessful); Assert.AreEqual(CharacterCreationResponseCode.NameUnavailableError, result.ResultCode); }