public void String() { var s = "foo"; QUnit.IsTrue(s is string); QUnit.IsTrue(!(s is int)); }
public void GetEnumerator() { var array = new[] { 1, 2, 3 }; array.GetEnumerator(); QUnit.IsTrue(true); // Just making sure the method is present }
public void IsAssignableFrom() { var subClass = typeof(SubClass); var baseClass = typeof(TestClass); QUnit.IsTrue(baseClass.IsAssignableFrom(subClass)); }
public void IsDigit() { QUnit.IsTrue(char.IsDigit('0')); QUnit.IsTrue(char.IsDigit('3')); QUnit.IsTrue(char.IsDigit('9')); QUnit.IsTrue(!char.IsDigit('a')); }
public void IsInstanceOfType() { var subClass = new SubClass(); var baseClass = typeof(TestClass); QUnit.IsTrue(baseClass.IsInstanceOfType(subClass)); }
public void TestClass() { var o = new MyClass(); QUnit.IsTrue(o is MyClass); QUnit.IsTrue(o is object); QUnit.IsTrue(!(o is string)); }
public void IntTryParse() { var s = "1"; int i; QUnit.IsTrue(int.TryParse(s, out i)); QUnit.AreEqual(i, 1); }
public void IsWhiteSpace() { QUnit.IsTrue(char.IsWhiteSpace(' ')); QUnit.IsTrue(char.IsWhiteSpace('\t')); QUnit.IsTrue(char.IsWhiteSpace('\r')); QUnit.IsTrue(char.IsWhiteSpace('\n')); QUnit.IsTrue(!char.IsWhiteSpace('a')); }
public void String() { object o = "foo"; var s = o as string; QUnit.IsTrue(s is string); QUnit.IsTrue(!(s is int)); }
public void TestClass() { object o = new MyClass(); var myClass = o as MyClass; QUnit.IsTrue(myClass is MyClass); QUnit.IsTrue(myClass is object); QUnit.IsTrue(!(myClass is string)); }
public void SimpleUsing() { var foo = new Foo(); using (foo) { } QUnit.IsTrue(foo.IsDisposed); }
public void BasicEventExplicitThis() { var o = new EventClass(); var success = false; o.FooThis += () => success = true; o.OnFooThis(); QUnit.IsTrue(success); }
public void Declaration() { Foo _foo; using (var foo = new Foo()) { _foo = foo; } QUnit.IsTrue(_foo.IsDisposed); }
public void MulticastEventKeepsDelegateType() { var i = 0; var eventClass = new EventClass(); eventClass.Foo += () => i++; eventClass.Foo += () => i++; var action = eventClass.GetFoo(); QUnit.IsTrue(action is Action); }
public void Casts() { object o = null; o = (int)o; o = (string)o; o = (int[])o; o = (float[])o; o = (bool[])o; QUnit.IsTrue(true); }
public void FormatException() { try { int.Parse("a"); QUnit.IsTrue(false); } catch (FormatException e) { QUnit.IsTrue(true); } }
public void NakedCatchClause() { try { throw new Exception(); QUnit.IsTrue(false); } catch { QUnit.IsTrue(true); } }
public void ExceptionCaught() { try { throw new Exception(); QUnit.IsTrue(false); } catch (Exception e) { QUnit.IsTrue(true); } }
public void MulticastEvent() { var o = new EventClass(); var success1 = false; var success2 = false; o.Foo += () => success1 = true; o.Foo += () => success2 = true; o.OnFoo(); QUnit.IsTrue(success1); QUnit.IsTrue(success2); }
public void MulticastEventRemove() { var o = new EventClass(); var success1 = false; var success2 = false; Action foo1 = () => success1 = true; o.Foo += foo1; o.Foo += () => success2 = true; o.Foo -= foo1; o.OnFoo(); QUnit.IsTrue(!success1); QUnit.IsTrue(success2); }
public void EventAccessor() { var eventClass = new EventClass(); var ran = false; Action evt = () => ran = true; eventClass.Bar += evt; eventClass.OnBar(); QUnit.IsTrue(ran); ran = false; eventClass.Bar -= evt; eventClass.OnBar(); QUnit.IsTrue(!ran); }
public void TryFinallyThrowsException() { var enumerator = YieldClass.TryFinallyThrowsException(true).GetEnumerator(); QUnit.IsTrue(enumerator.MoveNext()); QUnit.AreEqual(enumerator.Current, 1); try { enumerator.MoveNext(); QUnit.IsTrue(false); } catch (Exception) { QUnit.IsTrue(true); } }
public void RemoveMethodHandler() { var eventClass = new EventClass(); var eventHandlers = new EventHandlers(); eventClass.Foo += eventHandlers.M1; eventClass.Foo += eventHandlers.M2; eventClass.OnFoo(); QUnit.AreEqual(eventHandlers.m1, "M1"); QUnit.AreEqual(eventHandlers.m2, "M2"); eventHandlers.m1 = null; eventHandlers.m2 = null; eventClass.Foo -= eventHandlers.M1; eventClass.OnFoo(); QUnit.AreEqual(eventHandlers.m2, "M2"); QUnit.IsTrue(eventHandlers.m1 == null); }
public void FinallyExecuted() { bool success = false; try { try { throw new Exception(); } finally { success = true; } } // ReSharper disable once EmptyGeneralCatchClause catch (Exception e) { } QUnit.IsTrue(success); }
public void StartsWith() { var s = "HelloWorld"; QUnit.IsTrue(s.StartsWith("Hello")); }
public void EndsWith() { var s = "HelloWorld"; QUnit.IsTrue(s.EndsWith("World")); }
public void ExportArray() { Jsni.reference("window").memberset("ExportTest", Jsni.@object(new { Values = Jsni.array() })); ExportTest.Values[0] = Tuple.Create("foo", 1); QUnit.IsTrue(ExportTest.Values is Tuple <string, int>[]); }
public void Contains() { var s = "hello world"; QUnit.IsTrue(s.Contains("world")); }
public void ThreeFlags() { var oneAndTwo = FlagsEnum.One | FlagsEnum.Two | FlagsEnum.Three; QUnit.IsTrue((oneAndTwo & FlagsEnum.One) == FlagsEnum.One); }
public void GetTypeByName() { var type = Type.GetType("WootzJs.Compiler.Tests.TypeTests.TestClass"); QUnit.IsTrue(type != null); }