Ejemplo n.º 1
0
        async void IUseCase.Begin()
        {
            var init = await repository.GetCountAsync();

            presenter.SetText($"{init}");
            var count = new CountVo(init);

            presenter
            .ButtonClickObservable
            .Subscribe(async _ => {
                var oldCount = count.Count;
                var newCount = counter.CountUp(count);
                if (oldCount != newCount)
                {
                    presenter.SetText($"{newCount}");
                    await repository.SetCountAsync(newCount);
                }
            })
            .AddTo(disposables);
        }
 public void CountUpTest()
 {
     Assert.AreEqual(1, countUp.CountUp(count));
     Assert.AreEqual(2, countUp.CountUp(count));
     Assert.AreEqual(3, countUp.CountUp(count));
     Assert.AreEqual(4, countUp.CountUp(count));
     Assert.AreEqual(5, countUp.CountUp(count));
     Assert.AreEqual(6, countUp.CountUp(count));
     Assert.AreEqual(7, countUp.CountUp(count));
     Assert.AreEqual(8, countUp.CountUp(count));
     Assert.AreEqual(9, countUp.CountUp(count));
     Assert.AreEqual(10, countUp.CountUp(count));
     Assert.AreEqual(10, countUp.CountUp(count));
 }