Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }