System.Net.Mail.Tests.AlternateViewCollectionTest.TestDispose C# (CSharp) Méthode

TestDispose() private méthode

private TestDispose ( ) : void
Résultat void
        public void TestDispose()
        {
            avc.Add(av);
            avc.Dispose();

            // The individual items also disposed
            Assert.Throws<ObjectDisposedException>(() => av.LinkedResources);

            AlternateView av1 = AlternateView.CreateAlternateViewFromString("test", new ContentType("text/plain"));
            Assert.Throws<ObjectDisposedException>(() => avc.Add(av1));
            Assert.Throws<ObjectDisposedException>(() => avc.Clear());
            
            // No throw on second dispose
            avc.Dispose();
        }