public void DivisionByZeroTest() { //we expect that yesno should throw and exception but number and text should add, resp. concat. NumberWrapper na = new NumberWrapper(12345); NumberWrapper nb = new NumberWrapper(0); bool exceptionRaised = false; try{ var c = na/nb; } catch (Exception e){ Assert.IsInstanceOfType(e, typeof(DivisionByZeroError)); exceptionRaised = true; } Assert.IsTrue(exceptionRaised,"No exception has been raised"); }
public void EvaluatedValueComparisson() { YesnoWrapper yes = new YesnoWrapper(true); YesnoWrapper no = new YesnoWrapper(false); NumberWrapper a = new NumberWrapper(12345); NumberWrapper b = new NumberWrapper(12345); Assert.IsTrue((a == b).ToBool()); Number n = new Number(); n.Value = 12345; NumberWrapper c = new NumberWrapper(n); Assert.IsTrue((c == a).ToBool()); Assert.IsFalse((c != a).ToBool()); b.Value = 23456; Assert.IsFalse((c == b).ToBool()); Assert.IsTrue((c != b).ToBool()); }
public void PlusOperatorTest() { //we expect that yesno should throw and exception but number and text should add, resp. concat. NumberWrapper na = new NumberWrapper(12345); NumberWrapper nb = new NumberWrapper(12345); TextWrapper ta = new TextWrapper("bla"); TextWrapper tb = new TextWrapper("ble"); Assert.AreEqual(24690, (na + nb).Value); Assert.AreEqual("blable", (ta + tb).Value); }
public WidgetBase GetWidget(QuestionUnit unit, NumberWrapper typeWrapper) { unit.InitialiseValue(typeWrapper); return new NumberWidget(unit); }
protected static bool ContainsNullValue(NumberWrapper a, NumberWrapper b) { return ReferenceEquals(a, null) || ReferenceEquals(b, null) || ReferenceEquals(null, a.Value) || ReferenceEquals(null, b.Value); }
public bool Equals(NumberWrapper obj) { return Value == obj.Value; }
protected static bool ContainsNullValue(NumberWrapper a, NumberWrapper b) { return(ReferenceEquals(a, null) || ReferenceEquals(b, null) || ReferenceEquals(null, a.Value) || ReferenceEquals(null, b.Value)); }
public bool Equals(NumberWrapper obj) { return(Value == obj.Value); }