Exemplo n.º 1
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context = context;
     Issues   = new IssueReponsitory(context);
     Projects = new ProjectRepository(context);
     Trackers = new TrackerRepository(context);
 }
Exemplo n.º 2
0
        public void GetSnapshotTest()
        {
            //var mock = new Mock<IHttpClient>();
            //mock.Setup(x => x.JsonGet(It.IsAny<string>())).ReturnsAsync(@"{""title"":""Salt for all""}");
            var httpClient        = new HttpClient();
            var trackerRepository = new TrackerRepository();
            var importer          = new SnapshotImporter(httpClient, trackerRepository);

            var result = importer.GetSnapshot(new Tuple <string, string>("standard", "2016-09-10")).Result;

            Assert.AreEqual("Salt for all", result.Title);
        }
Exemplo n.º 3
0
        public void ImportDecksTest()
        {
            var httpClient        = new HttpClient();
            var trackerRepository = new TrackerRepository();
            var importer          = new SnapshotImporter(httpClient, trackerRepository);

            //_logger.Info("Starting meta deck import");
            int deckCount = 0;
            // delete previous snapshot decks
            //if (deletePrevious)
            //{
            //    _logger.Info("Deleting previous meta decks");
            //    _tracker.DeleteAllDecksWithTag(PluginTag);
            //}
            // get the lastest meta snapshot slug/date
            var slug = importer.GetSnapshotSlug();
            // use the slug to request the actual snapshot details
            //var snapshot = await GetSnapshot(slug);
            // add all decks to the tracker
            //foreach (var dt in snapshot.DeckTiers)
            //{
            //    var cards = "";
            //    _logger.Info($"Importing deck ({dt.Name})");
            //    foreach (var cd in dt.Deck.Cards)
            //    {
            //        cards += cd.Detail.Name;
            //        // don't add count if only one
            //        if (cd.Quantity > 1)
            //            cards += $" x {cd.Quantity}";
            //        cards += "\n";
            //    }
            //    // remove trailing newline
            //    if (cards.Length > 1)
            //        cards = cards.Substring(0, cards.Length - 1);

            //    // optionally remove player class from deck name
            //    // e.g. 'Control Warrior' => 'Control'
            //    var deckName = dt.Name;
            //    if (removeClass)
            //        deckName = deckName.Replace(dt.Deck.PlayerClass, "").Trim();

            //    _tracker.AddDeck(deckName, dt.Deck.PlayerClass, cards, archive, ArchetypeTag, PluginTag);
            //    deckCount++;
        }
Exemplo n.º 4
0
 public TrackerService()
 {
     _trackerRepository = new TrackerRepository();
 }
Exemplo n.º 5
0
 public SnapshotImporter(TrackerRepository tracker)
 {
     _tracker       = tracker;
     _decksFound    = 0;
     _decksImported = 0;
 }