Ejemplo n.º 1
0
        public void GivenACompleteValidCharacter_AddsCharacter()
        {
            // Arrange
            var expectedName           = "Meraddison";
            var expectedClass          = "Warlock";
            var expectedSpecialization = "Affliction";
            var expectedLevel          = 120;
            var expectedRealm          = "area-52";
            var expectedRace           = "Undead";
            var expectedGender         = CharacterGender.Female;
            int?expectedGameId         = null;

            var dto = new AddCharacterRequest(DefaultPlayer.Id, expectedGameId, expectedName, expectedGender,
                                              expectedLevel, expectedClass, expectedSpecialization, expectedRace, expectedRealm);

            // Act
            var result = _controller.AddCharacter(dto);

            var foundCharacter = Context.Characters.Find(result.Value);

            // Assert
            foundCharacter.Should().NotBeNull();
            foundCharacter.PlayerId.Should().Be(DefaultPlayer.Id);
            foundCharacter.Name.Should().Be(expectedName);
            foundCharacter.GameId.Should().BeNull();
            foundCharacter.Class.Should().Be(expectedClass);
            foundCharacter.Race.Should().Be(expectedRace);
            foundCharacter.Level.Should().Be(expectedLevel);
            foundCharacter.Gender.Should().Be(expectedGender);
            foundCharacter.Realm.Should().Be(expectedRealm);
        }
Ejemplo n.º 2
0
 public void Create()
 {
     if (characterName != "")
     {
         CharactersController.AddCharacter(characterName, Controller.Instance.Options, Controller.Instance.Characters);
     }
     else
     {
         Debug.LogError("Character name was empty.");
     }
     Close();
 }