public void InvokeGoHome() { var view = new MockBrowserView(); var history = new MockHistory(); var favorites = new MockFavorites(); var config = new MockConfig(); var presenter = new BrowserPresenter <MockTabPresenter>( view, history, favorites, config, new MockFaviconCache(), (tab, f, c, favicons, h, tabHistory) => new MockTabPresenter(tab, f, c, favicons, h, tabHistory)); var url = Url.FromString("www.myfavorite.com"); var url2 = Url.FromString("www.myfavorite2.com"); favorites.GetOrCreate(url); favorites.GetOrCreate(url2); view.InvokeFavoritesListOpen(0); view.InvokeFavoritesListOpen(1); view.InvokeFavoritesListOpen(0); Assert.AreEqual(history.GetViewModel()[history.GetViewModel().Count - 1].GetUrl(), url); view.InvokeGoHome(); Assert.AreEqual(history.GetViewModel()[history.GetViewModel().Count - 1].GetUrl(), config.Home); }
public MetricUrlBuilderTests() { _config = new MockConfig { ApiKey = "123", BaseAddress = "abc" }; _sut = new MetricUrlBuilder(_config); }
public void ShouldRequestContinue__Returns_False_If_Playbook_Not_In_Config() { var configProps = new Dictionary <string, string>(); var mockConfig = new MockConfig(configProps); var mockShortCircuitImplementation = new GetGlobalActionsShortCircuit(mockConfig); var result = mockShortCircuitImplementation.ShouldRequestContinue(mockConfig); Assert.AreEqual(result, false); }
public TestContext() { Units = new List <IUnit> { new MockUnit() }; Config = new MockConfig(); Player = new MockPlayer(); Target = new NullUnit(); MockAPI = new MockEliteAPI(); API = new MockEliteAPIAdapter(MockAPI); Memory = new StateMemory(API); }
public OpenWeatherClientTests() { _config = new MockConfig { BaseAddress = "http://api.openweathermap.org/data/2.5/weather", ApiKey = "62ffa8c4c1dfbc438b162198e174c4cb", State = "wa", IsoCountryCode = "au" }; _sut = new OpenWeatherClient(new HttpClient(), _config, new MetricUrlBuilder(_config)); }
public void ShouldRequestContinue__Returns_True_If_Playbook_In_Config() { var configProps = new Dictionary <string, string>(); configProps.Add("Microservices:0", "Playbook"); var mockConfig = new MockConfig(configProps); var mockShortCircuitImplementation = new GetEventTypeShortCircuit(mockConfig); var result = mockShortCircuitImplementation.ShouldRequestContinue(mockConfig); Assert.AreEqual(result, true); }
public void SHOULD_set_class_and_method_names() { //Arrange MockConfig.With(x => x.InstrumentationKey, "instrument"); MockConfig.With(x => x.RoleName, "Mata Hari"); //Act var result = Sut.DecorateTelemetry(new EventTelemetry("event"), "Class Name", "Method Name", new MockBuilder <IAnalyticsOperation>().Object, new MockBuilder <IAnalyticsSession>().Object, new Dictionary <string, object>()); //Assert Assert.That(result.Properties["Class"], Is.EqualTo("Class Name")); Assert.That(result.Properties["Method"], Is.EqualTo("Method Name")); }
public void SHOULD_append_config_values() { //Arrange MockConfig.With(x => x.InstrumentationKey, "instrument"); MockConfig.With(x => x.RoleName, "Mata Hari"); //Act var result = Sut.DecorateTelemetry(new EventTelemetry("event"), "Class Name", "Method Name", new MockBuilder <IAnalyticsOperation>().Object, new MockBuilder <IAnalyticsSession>().Object, new Dictionary <string, object>()); //Assert Assert.That(result.Context.Cloud.RoleName, Is.EqualTo("Mata Hari")); Assert.That(result.Context.InstrumentationKey, Is.EqualTo("instrument")); }
public async Task Test1() { // Arrange var mockRepo = new MockMessagesRepository(); var mockConfig = new MockConfig(); var controller = new HomeController(null, null, null, mockConfig, mockRepo); var m = new Message { Username = "******", Text = "test" }; // Act var result = await controller.Create(m); // Assert var okResult = Assert.IsType <Microsoft.AspNetCore.Mvc.OkResult>(result); }
public void InvokeGoHomeTest() { var config = new MockConfig(); var tabHistory = new MockTabHistory(); var view = new MockTabView(); var presenter = new TabPresenter( view, new MockFavorites(), config, new MockFaviconCache(), new MockHistory(), tabHistory); view.InvokeGoHome(); Assert.AreEqual(config.Home, tabHistory.Current().Url); }
public void IF_configured_min_logSeverity_is_higher_than_message_SHOULD_not_trace_to_server() { //Arrange CurrentBuildConfig = BuildConfig.Debug; var properties = new Dictionary <string, object>(); MockConfig.With(x => x.MinimumLogToServerSeverity, new Dictionary <IBuildConfig, LogSeverity> { { BuildConfig.Debug, LogSeverity.Information } }); //Act Sut.Trace(this, "Trace message", LogSeverity.Verbose, properties); //Assert MockConsoleLogger.Mock.Verify(x => x.LogTrace("Trace message", LogSeverity.Verbose, It.IsAny <Dictionary <string, string> >())); MockTelemetryClient.Mock.Verify(x => x.TrackTrace(It.IsAny <TraceTelemetry>()), Times.Never); }
public MockKapturePlugin(int langCode = 0) { PluginName = "Kapture"; Localization = new Localization(this); Configuration = new MockConfig { AddEnabled = true, CastEnabled = true, CraftEnabled = true, DesynthEnabled = true, DiscardEnabled = true, GatherEnabled = true, GreedEnabled = true, LostEnabled = true, NeedEnabled = true, ObtainEnabled = true, PurchaseEnabled = true, SearchEnabled = true, SellEnabled = true, UseEnabled = true }; RollMonitor = new RollMonitor(this); if (langCode == 0) { LootProcessor = new ENLootProcessor(this); } else if (langCode == 1) { LootProcessor = new ENLootProcessor(this); } else if (langCode == 2) { LootProcessor = new DELootProcessor(this); } else if (langCode == 3) { LootProcessor = new ENLootProcessor(this); } else if (langCode == 4) { LootProcessor = new ZHLootProcessor(this); } }
public void InvokeHistoryListSave() { var view = new MockBrowserView(); var history = new MockHistory(); var config = new MockConfig(); var presenter = new BrowserPresenter <MockTabPresenter>( view, history, new MockFavorites(), config, new MockFaviconCache(), (tab, favorites, c, favicons, h, tabHistory) => new MockTabPresenter(tab, favorites, c, favicons, h, tabHistory)); // save mock.com to favorites view.InvokeHistoryListSave(0); // open mock.com from favorites view.InvokeFavoritesListOpen(0); Assert.AreEqual(config.Home, history.GetViewModel()[history.GetViewModel().Count - 1].GetUrl()); }
public void InvokeFavoritesListOpen() { var config = new MockConfig(); var favorites = new MockFavorites(); var view = new MockBrowserView(); var presenter = new BrowserPresenter <MockTabPresenter>( view, new MockHistory(), favorites, config, new MockFaviconCache(), (tab, f, c, favicons, history, tabHistory) => new MockTabPresenter(tab, f, c, favicons, history, tabHistory)); favorites.GetOrCreate(Url.FromString("www.myfavorite.com")); view.InvokeFavoritesListOpen(0); // easiest way to check if the url has changed var oldHome = config.Home; view.InvokeHomeChanged(); Assert.AreNotEqual(oldHome, config.Home); }
public void InvokeHistoryListOpen() { var config = new MockConfig(); var favorites = new MockFavorites(); var view = new MockBrowserView(); var presenter = new BrowserPresenter <MockTabPresenter>( view, new MockHistory(), favorites, config, new MockFaviconCache(), (tab, f, c, favicons, history, tabHistory) => new MockTabPresenter(tab, f, c, favicons, history, tabHistory)); var url = Url.FromString("www.myfavorite.com"); var url2 = Url.FromString("www.myfavorite2.com"); favorites.GetOrCreate(url); favorites.GetOrCreate(url2); view.InvokeFavoritesListOpen(0); view.InvokeFavoritesListOpen(1); // 0 - mock.com // 1 - url // 2 - url2 view.InvokeHistoryListOpen(1); // easiest way to check if the url has changed view.InvokeHomeChanged(); Assert.AreEqual(url, config.Home); view.InvokeHistoryListOpen(2); // easiest way to check if the url has changed view.InvokeHomeChanged(); Assert.AreEqual(url2, config.Home); }
public void ReturnsNullWithMockConfig() { MockConfig mc = new MockConfig(); Assert.IsNull(DataBaseFactory.getDatabase(mc)); }