public virtual void TestSetOnce_mem() { SetOnce <Integer> set = new SetOnce <Integer>(); set.Set(new Integer(5)); Assert.AreEqual(5, set.Get().value); Assert.Throws <AlreadySetException>(() => set.Set(new Integer(7))); }
public virtual void TestSetOnce_mem() { SetOnce <int?> set = new SetOnce <int?>(); set.Set(new int?(5)); Assert.AreEqual(5, (int)set.Get()); set.Set(new int?(7)); }
public virtual void TestSetOnce_mem() { SetOnce <int?> set = new SetOnce <int?>(); set.Set(new int?(5)); Assert.AreEqual(5, (int)set.Get()); Assert.Throws <SetOnce <int?> .AlreadySetException>(() => { set.Set(new int?(7)); }); }
public override void Run() { try { Sleep(RAND.Next(10)); // sleep for a short time Set.Set(new int?(Convert.ToInt32(Name.Substring(2)))); Success = true; } catch (ThreadInterruptedException e) { // ignore } catch (Exception e) { // TODO: change exception type // expected. Success = false; } }
public override void Run() { try { Sleep(RAND.Next(10)); // sleep for a short time set.Set(new Integer(Convert.ToInt32(Name.Substring(2), CultureInfo.InvariantCulture))); success = true; } catch (Exception e) when(e.IsInterruptedException()) { // ignore } catch (Exception e) when(e.IsRuntimeException()) { // TODO: change exception type // expected. success = false; } }
public override void Run() { try { Sleep(RAND.Next(10)); // sleep for a short time set.Set(new Integer(Convert.ToInt32(Name.Substring(2), CultureInfo.InvariantCulture))); success = true; } #if !NETSTANDARD1_6 catch (ThreadInterruptedException) { // ignore } #endif catch (Exception) { // TODO: change exception type // expected. success = false; } }