public void To_observable() { var results = new List <IResult>(); Exception e = null; RxHelper.ToObservable(FakeResult()).Subscribe(r => { results.Add(r); r.Execute(new ActionExecutionContext()); }, x => e = x); Assert.IsNull(e, e?.ToString()); Assert.AreEqual(1, results.Count); }
public void Recalculate_retail_cost() { var line = Line(); Calculate(line); Assert.AreEqual(55.70, line.RetailCost); Assert.AreEqual(29.84, line.RealRetailMarkup); var items = RxHelper.CollectChanges(line); line.RetailMarkup = 50; Assert.AreEqual(64.30, line.RetailCost); Assert.AreEqual(49.88, line.RetailMarkup); Assert.AreEqual(49.88, line.RealRetailMarkup); Assert.That(items.Select(e => e.PropertyName), Is.EquivalentTo(new[] { "RetailCost", "RetailSum", "RealRetailMarkup", "RetailMarkup", "IsMarkupInvalid", "IsMarkupToBig" })); }
protected void Execute(IEnumerable <IResult> results) { RxHelper.ToObservable(results).Subscribe(v => ResultsSink.OnNext(v)); }