Пример #1
0
        public void Adorner_should_be_destroyed_on_unload()
        {
            var backstage = new Backstage
            {
                Content = new Button()
            };

            using (var window = new TestRibbonWindow(backstage))
            {
                Assert.That(backstage.IsLoaded, Is.True);

                Assert.That(backstage.GetFieldValue <object>("adorner"), Is.Null);

                backstage.IsOpen = true;

                Assert.That(backstage.GetFieldValue <object>("adorner"), Is.Not.Null);

                backstage.IsOpen = false;

                Assert.That(backstage.GetFieldValue <object>("adorner"), Is.Not.Null);

                window.Content = null;

                UIHelper.DoEvents();

                Assert.That(backstage.GetFieldValue <object>("adorner"), Is.Null);
            }
        }