public void SetUp() { // Setup IHttpClient Mocks var httpJsonTask = new TaskCompletionSource <string>(); httpJsonTask.SetResult(tappedOutJson); unitTestContext.HttpClientMock.Setup(h => h.GetAsJson("http://tappedout.net/api/deck/latest/edh/")) .Returns(httpJsonTask.Task); // Setup IUrlShortener Mocks unitTestContext.UrlShortenerMock.Setup(u => u.ShortenUrl("http://tappedout.net/mtg-decks/22-01-15-deck-1/")) .Returns("http://deck1"); unitTestContext.UrlShortenerMock.Setup(u => u.ShortenUrl("http://tappedout.net/mtg-decks/deck-2/")) .Returns("http://deck2"); unitTestContext.UrlShortenerMock.Setup(u => u.ShortenUrl("http://tappedout.net/mtg-decks/21-01-15-deck-3-esper/")) .Returns("http://deck3"); plugin = new TappedOutLatestEDHPlugin( unitTestContext.BotServicesMock.Object, unitTestContext.BotConfig); plugin.LoggingService = unitTestContext.LoggingServiceMock.Object; }
public void SetUp() { // Setup ICardPriceStore Mocks priceStoreMock = new Mock <ICardPriceStore>(); // Setup ICommandParser Mocks commandParserMock = new Mock <ICommandParser>(); // Setup IHttpClient Mocks var httpJsonTask = new TaskCompletionSource <string>(); httpJsonTask.SetResult(tappedOutJson); httpClientMock = new Mock <IHttpClient>(); httpClientMock.Setup(h => h.GetAsJson("http://tappedout.net/api/deck/latest/edh/")) .Returns(httpJsonTask.Task); // Setup IUrlShortener Mocks urlShortenerMock = new Mock <IUrlShortener>(); urlShortenerMock.Setup(u => u.ShortenUrl("http://tappedout.net/mtg-decks/22-01-15-deck-1/")) .Returns("http://deck1"); urlShortenerMock.Setup(u => u.ShortenUrl("http://tappedout.net/mtg-decks/deck-2/")) .Returns("http://deck2"); urlShortenerMock.Setup(u => u.ShortenUrl("http://tappedout.net/mtg-decks/21-01-15-deck-3-esper/")) .Returns("http://deck3"); // Setup IMessenger Mocks messengerMock = new Mock <IMessenger>(); plugin = new TappedOutLatestEDHPlugin( mtgStore, priceStoreMock.Object, commandParserMock.Object, httpClientMock.Object, urlShortenerMock.Object, new BotConfig()); plugin.LoggingService = loggingServiceMock.Object; }