public void InitializedEventArgumentType() { Factorial.Factorial f = new Factorial.Factorial(3); f.Initialized += (fact) => { Assert.AreEqual(fact.GetType(), typeof(Factorial.Factorial)); }; f.Start(); }
public void InitializedEventArgumentValues() { Factorial.Factorial f = new Factorial.Factorial(3); f.Initialized += (fact) => { Assert.AreEqual(fact.Number, 3); Assert.AreEqual(fact.Result, null); }; f.Start(); }
static void Main(string[] args) { Factorial f1 = new Factorial(5); Factorial f2 = new Factorial(3); Selector selector = new Selector(); Invalid invalid = new Invalid(); IsZero isZero = new IsZero(); IsSimple isSimple = new IsSimple(); FactorialCalculating factorialCalculating = new FactorialCalculating(); CalculatingSelector calculatingSelector = new CalculatingSelector(); Iterator iterator = new Iterator(); IsReady isReady = new IsReady(); f1.Initialized += selector.Select; f2.Initialized += selector.Select; selector.FactorialIsInvalid += invalid.FactorialIsInvalid; selector.FactorialIsSimple += isSimple.FactorialIsSimple; selector.FactorialIsZero += isZero.FactorialIsZero; selector.FactorialNeedCalculating += factorialCalculating.FactorialCalculatingPrepare; factorialCalculating.IsReady += calculatingSelector.Select; calculatingSelector.NeedIteration += iterator.Iterate; iterator.IsReady += calculatingSelector.Select; calculatingSelector.IsReady += isReady.FactorialWrite; isZero.IsReady += isReady.FactorialWrite; isSimple.IsReady += isReady.FactorialWrite; f1.Start(); f2.Start(); }
public void InitializedEventEmission() { Factorial.Factorial f = new Factorial.Factorial(3); f.Initialized += (fact) => { throw new EventRaisedExeption(); }; Assert.ThrowsException <EventRaisedExeption>(() => { f.Start(); }); }