public RectangularCardImagePositionProviderTest() { _fixture = new Fixture(); _cardSize = _fixture.Create<Size>(); _description = new RectangularDeckImageDescription { CardWidth = _cardSize.Width, CardHeight = _cardSize.Height, Ranks = new[] { Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King }, Suits = new[] { Clubs, Diamonds, Hearts, Spades } }; _fixture.Inject<IRectangularDeckImageDescription>(_description); }
private void ParseDescriptionFile(string deckDirectory, string[] descriptionLines) { var imageDescription = new RectangularDeckImageDescription(); var lineIndex = 0; _cardsImage = new BitmapImage(new Uri(Path.Combine(deckDirectory, descriptionLines[lineIndex++]))); _imageSize = new CardSize(_cardsImage.PixelWidth, _cardsImage.PixelHeight); var offsetParts = descriptionLines[lineIndex++].Split(' '); imageDescription.HorizontalOffsetOfFirstCard = double.Parse(offsetParts[0], CultureInfo.InvariantCulture); imageDescription.VerticalOffsetOfFirstCard = double.Parse(offsetParts[1], CultureInfo.InvariantCulture); var cardSizeParts = descriptionLines[lineIndex++].Split(' '); imageDescription.CardWidth = double.Parse(cardSizeParts[0], CultureInfo.InvariantCulture); imageDescription.CardHeight = double.Parse(cardSizeParts[1], CultureInfo.InvariantCulture); _ratio = imageDescription.CardWidth / imageDescription.CardHeight; var spacingParts = descriptionLines[lineIndex++].Split(' '); imageDescription.HorizontalSpacingBetweenCards = double.Parse(spacingParts[0], CultureInfo.InvariantCulture); imageDescription.VerticalSpacingBetweenCards = double.Parse(spacingParts[1], CultureInfo.InvariantCulture); imageDescription.Ranks = GetRanks(descriptionLines[lineIndex++]); imageDescription.Suits = GetSuits(descriptionLines[lineIndex]); _cardImagePositionProvider = new RectangularCardImagePositionProvider(imageDescription); }