public async void Get_meta_returns_null_if_key_does_not_exist() { // Act var meta = await _repo.GetAsync("NotExist", EMetaType.Setting); // Assert Assert.Null(meta); }
public async void When_user_activates_a_plugin_two_meta_records_could_be_created() { // Given a plugin and when user activates it var id = await pluginService.ActivatePluginAsync(MY_PLUGIN_FOLDER); // Then there will be a plugin meta var pluginMeta = await metaRepository.GetAsync(id); Assert.NotNull(pluginMeta); // And the plugin's Active property is true var plugin = await pluginService.GetExtensionAsync(id); Assert.True(plugin.Active); }
public async void A_widget_is_instantiated_from_json_and_type_info_strings() { // Given a widget in the area blog sidebar1 var widgetId = await _svc.CreateWidgetAsync(MY_WIDGET_TYPE); await _svc.AddWidgetToAreaAsync(widgetId, WidgetService.BlogSidebar1.Id, 0); // When the meta record is retrieved var widgetMeta = await _metaRepo.GetAsync(widgetId); // I'm able to get the widget type var widget = (Widget)JsonConvert.DeserializeObject(widgetMeta.Value, typeof(Widget)); Assert.Equal(MY_WIDGET_TYPE, widget.Type); // Given a json string that represent an instance of MyWidget string json = @"{""age"":10,""title"":""Tags"",""id"":0, ""type"":""Fan.IntegrationTests.Widgets.MyWidget, Fan.IntegrationTests""}"; // And the widget type I got from above var type = Type.GetType(widget.Type); // When I deserialize it var myWidget = (MyWidget)JsonConvert.DeserializeObject(json, type); // Then we get the actual instance Assert.Equal(10, myWidget.Age); }