Beispiel #1
0
        public void ModulesWithWidgetsShouldListAllChildWidgets()
        {
            const string TextBlockName = "lblFoo";
            const string ButtonName = "btnBar";

            // Register our controls
            var module = new AlfredTestModule(Container);
            module.WidgetsToRegisterOnInitialize.Add(new TextWidget(BuildWidgetParams(TextBlockName)));
            module.WidgetsToRegisterOnInitialize.Add(new ButtonWidget(BuildWidgetParams(ButtonName)));

            // Don't do this normally, but this will be enough to populate the collection to evaluate
            module.Initialize(new TestAlfred());

            // Grab the values for assertion
            var providers = module.PropertyProviders.ToList();

            // Make sure the items we just put in there are present
            Assert.IsNotNull(providers.Find(TextBlockName), $"Could not find {TextBlockName}");
            Assert.IsNotNull(providers.Find(ButtonName), $"Could not find {ButtonName}");
        }