public void Exceptions() { Calculator_ calc = new Calculator_(new CalculatorProps { InitialValue = 20, MaximumValue = 30, }); calc.Add(3); Assert.Equal((double)23, calc.Value); Assert.Throws <JsiiException>(() => calc.Add(10)); calc.MaxValue = 40; calc.Add(10); Assert.Equal((double)33, calc.Value); }
public void Maps() { // TODO: Generator should create a parameterless constructor. Calculator_ calc = new Calculator_(new CalculatorProps()); calc.Add(10); calc.Add(20); calc.Mul(2); Assert.Collection( calc.OperationsMap["add"], val => { }, val => Assert.Equal((double)30, val.Value) ); Assert.Collection( calc.OperationsMap["mul"], val => { } ); }
public void GetAndSetNotPrimitiveProperties() { // TODO: Generator should create a parameterless constructor. Calculator_ calc = new Calculator_(new CalculatorProps()); calc.Add(3200000); calc.Neg(); calc.Curr = new Multiply(new Number(2), calc.Curr); Assert.Equal((double)-6400000, calc.Value); }
public void UnmarkshallIntoAbstractType() { // TODO: Generator should create a parameterless constructor. Calculator_ calc = new Calculator_(new CalculatorProps()); calc.Add(120); Value_ value = calc.Curr; Assert.Equal((double)120, value.Value); }
public void FluentApi() { Calculator_ calc = new Calculator_(new CalculatorProps { InitialValue = 20, MaximumValue = 30, }); calc.Add(3); Assert.Equal(23, calc.Value); }
public void GetAndSetEnumValues() { // TODO: Generator should create a parameterless constructor. Calculator_ calc = new Calculator_(new CalculatorProps()); calc.Add(9); calc.Pow(3); Assert.Equal(CompositionStringStyle.Normal, calc.StringStyle); calc.StringStyle = CompositionStringStyle.Decorated; Assert.Equal(CompositionStringStyle.Decorated, calc.StringStyle); Assert.Equal("<<[[{{(((1 * (0 + 9)) * (0 + 9)) * (0 + 9))}}]]>>", calc.ToString()); }
public void CallMethods() { // TODO: Generator should create a parameterless constructor. Calculator_ calc = new Calculator_(new CalculatorProps()); calc.Add(10); Assert.Equal((double)10, calc.Value); calc.Mul(2); Assert.Equal((double)20, calc.Value); calc.Pow(5); Assert.Equal((double)20 * 20 * 20 * 20 * 20, calc.Value); calc.Neg(); Assert.Equal((double)-3200000, calc.Value); }