示例#1
0
        public void ComponentIsRenderedFromCache()
        {
            var propertyName = CurrentTestName + "1";

            WithCacheSize(2, () => {
                string firstRenderedHtml;
                using (var sandbox = new Sandbox(Window, propertyName, DefaultTimeout)) {
                    firstRenderedHtml = sandbox.GetFirstRenderHtml();
                    Assert.IsEmpty(firstRenderedHtml);

                    firstRenderedHtml = sandbox.GetHtml();
                    Assert.IsNotEmpty(firstRenderedHtml);
                }

                using (var sandbox = new Sandbox(Window, propertyName, DefaultTimeout)) {
                    var currentRenderedHtml = sandbox.GetFirstRenderHtml();
                    AssertContains(currentRenderedHtml, firstRenderedHtml, "Component should have been rendered from cache");
                }
            });
        }
示例#2
0
        public async Task PropertyValuesArePassedToView()
        {
            await Run(async() => {
                const string PropertyValue = "test value";
                using var sandbox          = new Sandbox("initial value");
                var window = new Window()
                {
                    Title = CurrentTestName
                };

                try {
                    sandbox.AttachTo(window);
                    sandbox.PropertyValue = PropertyValue;
                    window.Show();
                    await sandbox.Initialize();

                    var actualPropertyValue = await sandbox.GetPropertyValue();
                    Assert.AreEqual(PropertyValue, actualPropertyValue);
                } finally {
                    window.Close();
                }
            });
        }