Exemplo n.º 1
0
        public void Reset_ResetAndEventRaised()
        {
            TestDataManager dm   = new TestDataManager();
            TestDataType    data = new TestDataType();

            dm.Add(data);
            TestDataObserver obs = new TestDataObserver();

            using IDisposable unsubscriber = dm.Subscribe(obs);
            dm.Reset();
            Assert.IsFalse(dm.GetAll().Any());
            Assert.AreEqual(0, obs.CompleteCount);
            Assert.AreEqual(0, obs.Errors.Count);
            Assert.AreEqual(1, obs.Next.Count);
            DataChanged <TestDataType> change = obs.Next.Dequeue();

            Assert.IsTrue(change.Action == DataChangedAction.Reset && change.OldItems?.FirstOrDefault() == data);
        }