public void GivenMapElement_WhenConvertToEntityType_ThenReturnTheRightType() { // Arrange var nonBreakableWall = new NonBreakableWall(); var breakableWall = new BreakableWall(); var playerOne = new PlayerDto() { EntityType = EntityType.PlayerOne }; var playerTwo = new PlayerDto() { EntityType = EntityType.PlayerTwo }; // Act var typeWall = _elementToTypeConverter.ConvertToEntityType(nonBreakableWall); var typeBreakableWall = _elementToTypeConverter.ConvertToEntityType(breakableWall); var typePlayerOne = _elementToTypeConverter.ConvertToEntityType(playerOne); var typePlayerTwo = _elementToTypeConverter.ConvertToEntityType(playerTwo); // Assert Check.That(typeWall).IsEqualTo(EntityType.Wall); Check.That(typeBreakableWall).IsEqualTo(EntityType.BreakableWall); Check.That(typePlayerOne).IsEqualTo(EntityType.PlayerOne); Check.That(typePlayerTwo).IsEqualTo(EntityType.PlayerTwo); }
public IEnumerable <MapElementDto> GetMapElementsFromMap(MapElementContainer[,] map) { var mapToList = map.Cast <MapElementContainer>(); return(mapToList.Select(actualElement => new MapElementDto() { Id = Guid.NewGuid(), CreatedDate = DateTime.Now, X = actualElement.X, Y = actualElement.Y, Type = _elementToTypeConverter.ConvertToEntityType(actualElement.MapElement) }).AsEnumerable()); }