public void SilentAccessTest() { var hlp = new Helpers.TestEventableProperties(); var mutex = 0; hlp.Volume = 10; hlp.ListenEvent(hlp, (sender, evName, args) => ++mutex > 0, "FreeSpaceChanged"); hlp.Size = hlp.Volume; using (hlp.GetSilentAccess()) hlp.Size = hlp.Volume + 1; Assert.IsTrue(hlp.Size == hlp.Volume + 1); Assert.IsTrue(mutex == 2); }
public void EventableAutoPropertyTest() { var hlp = new Helpers.TestEventableProperties(); var mutex = false; hlp.Volume = 10; hlp.ListenEvent(hlp, (sender, evName, args) => mutex, "VolumeChanging"); hlp.Volume = 5; Assert.IsTrue(hlp.Volume == 10); hlp.Size = hlp.Volume; Assert.IsTrue(hlp.Size == hlp.Volume); try { hlp.Size = hlp.Volume + 1; } catch (Helpers.TestException) { } catch (Exception) { throw; } Assert.IsTrue(hlp.Size == hlp.Volume); }