Exemple #1
0
        public void Dispose_InvokeDisposingNoForm_Nop(bool disposing)
        {
            using var context = new SubApplicationContext();
            context.Dispose(disposing);
            Assert.Null(context.MainForm);

            context.Dispose(disposing);
            Assert.Null(context.MainForm);
        }
Exemple #2
0
        public void Dispose_InvokeNotDisposingWithForm_Nop()
        {
            using var mainForm = new Form();
            using var context  = new SubApplicationContext(mainForm);
            context.Dispose(false);
            Assert.Same(mainForm, context.MainForm);
            Assert.False(mainForm.IsDisposed);

            context.Dispose(false);
            Assert.Same(mainForm, context.MainForm);
            Assert.False(mainForm.IsDisposed);
        }
Exemple #3
0
        public void Dispose_InvokeDisposingWithForm_Success()
        {
            using var mainForm = new Form();
            using var context  = new SubApplicationContext(mainForm);
            context.Dispose(true);
            Assert.Null(context.MainForm);
            Assert.True(mainForm.IsDisposed);

            context.Dispose(true);
            Assert.Null(context.MainForm);
            Assert.True(mainForm.IsDisposed);
        }