comparison Implab.Test/RunnableComponentTests.cs @ 208:7d07503621fe v2

RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool) IRunnable is now disposable Code cleanups, suppressed some CodeAnalysis warnings
author cin
date Sun, 13 Nov 2016 18:28:17 +0300
parents 8200ab154c8a
children
comparison
equal deleted inserted replaced
207:558f34b2fb50 208:7d07503621fe
93 [TestMethod] 93 [TestMethod]
94 public void ShouldCallDisposeOnStop() { 94 public void ShouldCallDisposeOnStop() {
95 var comp = new MockRunnableComponent(true); 95 var comp = new MockRunnableComponent(true);
96 96
97 bool disposed = false; 97 bool disposed = false;
98 comp.MockDispose = (disposing, error) => { 98 comp.MockDispose = (disposing) => {
99 disposed = true; 99 disposed = true;
100 }; 100 };
101 101
102 comp.Start().Join(1000); 102 comp.Start().Join(1000);
103 comp.Stop().Join(1000); 103 comp.Stop().Join(1000);
113 [TestMethod] 113 [TestMethod]
114 public void ShouldNotCallDisposeOnStop() { 114 public void ShouldNotCallDisposeOnStop() {
115 var comp = new MockRunnableComponent(true, true); 115 var comp = new MockRunnableComponent(true, true);
116 116
117 bool disposed = false; 117 bool disposed = false;
118 comp.MockDispose = (disposing, error) => { 118 comp.MockDispose = (disposing) => {
119 disposed = true; 119 disposed = true;
120 }; 120 };
121 121
122 comp.Start().Join(1000); 122 comp.Start().Join(1000);
123 comp.Stop().Join(1000); 123 comp.Stop().Join(1000);
129 [TestMethod] 129 [TestMethod]
130 public void SelfDisposeOnStop() { 130 public void SelfDisposeOnStop() {
131 var comp = new MockRunnableComponent(true, true); 131 var comp = new MockRunnableComponent(true, true);
132 132
133 bool disposed = false; 133 bool disposed = false;
134 Exception lastError = null; 134 comp.MockDispose = (disposing) => {
135 comp.MockDispose = (disposing, error) => {
136 disposed = true; 135 disposed = true;
137 lastError = error;
138 }; 136 };
139 137
140 comp.Start().Join(1000); 138 comp.Start().Join(1000);
141 comp.Stop().Join(1000); 139 comp.Stop().Join(1000);
142 140