private void DetectionFailure(ArchetypeConditionType condition, string[] archetypeCards, ArchetypeColor archetypeColor, string[] testMainboard, string[] testSideboard) { var archetype = new ArchetypeSpecific() { Conditions = new ArchetypeCondition[] { new ArchetypeCondition() { Type = condition, Cards = archetypeCards } } }; var result = ArchetypeAnalyzer.Detect( testMainboard.Select(c => new Card() { Count = 4, Name = c }).ToArray(), testSideboard.Select(c => new Card() { Count = 4, Name = c }).ToArray(), new ArchetypeFormat { Archetypes = new Archetype[] { archetype }, Lands = _modern.Lands, NonLands = _modern.NonLands }); result.Matches.Should().HaveCount(0); }
private static RecordArchetype GetArchetype(Deck deck, ArchetypeFormat format) { var detectionResult = ArchetypeAnalyzer.Detect(deck.Mainboard.Select(i => new Card() { Name = i.Card, Count = i.Count }).ToArray(), deck.Sideboard.Select(i => new Card() { Name = i.Card, Count = i.Count }).ToArray(), format); string colorID = detectionResult.Color.ToString(); string companionID = detectionResult.Companion == null ? "" : detectionResult.Companion.Value.ToString(); string archetypeID = "Unknown"; if (detectionResult.Matches.Length == 1) { archetypeID = GetArchetype(detectionResult.Matches.First(), detectionResult.Color); } if (detectionResult.Matches.Length > 1) { archetypeID = $"Conflict({String.Join(",", detectionResult.Matches.Select(m => GetArchetype(m, detectionResult.Color)))})"; } return(new RecordArchetype() { Archetype = archetypeID, Companion = companionID, Color = colorID, }); }