Beispiel #1
0
        public void TestRegisterAddsObserverToObserverList()
        {
            CoinReturn             coinReturn             = new CoinReturn();
            MockCoinReturnObserver mockCoinReturnObserver = new MockCoinReturnObserver();

            coinReturn.RegisterObserver(mockCoinReturnObserver);

            Assert.AreEqual(1, coinReturn.Observers.Count);
            Assert.AreEqual(mockCoinReturnObserver, coinReturn.Observers[0]);
        }
Beispiel #2
0
        public void TestClearCallsCoinReturnUpdatedOnObservers()
        {
            CoinReturn             coinReturn = new CoinReturn();
            MockCoinReturnObserver mockCoinReturnObserverOne = new MockCoinReturnObserver();
            MockCoinReturnObserver mockCoinReturnObserverTwo = new MockCoinReturnObserver();

            coinReturn.RegisterObserver(mockCoinReturnObserverOne);
            coinReturn.RegisterObserver(mockCoinReturnObserverTwo);

            coinReturn.Clear();

            Assert.AreEqual(1, mockCoinReturnObserverOne.NumberOfTimesCoinPurseUpdatedCalled);
            Assert.AreEqual(1, mockCoinReturnObserverTwo.NumberOfTimesCoinPurseUpdatedCalled);
        }
        public void TestRegisterAddsObserverToObserverList()
        {
            CoinReturn coinReturn = new CoinReturn();
            MockCoinReturnObserver mockCoinReturnObserver = new MockCoinReturnObserver();

            coinReturn.RegisterObserver(mockCoinReturnObserver);

            Assert.AreEqual(1, coinReturn.Observers.Count);
            Assert.AreEqual(mockCoinReturnObserver, coinReturn.Observers[0]);
        }
        public void TestClearCallsCoinReturnUpdatedOnObservers()
        {
            CoinReturn coinReturn = new CoinReturn();
            MockCoinReturnObserver mockCoinReturnObserverOne = new MockCoinReturnObserver();
            MockCoinReturnObserver mockCoinReturnObserverTwo = new MockCoinReturnObserver();

            coinReturn.RegisterObserver(mockCoinReturnObserverOne);
            coinReturn.RegisterObserver(mockCoinReturnObserverTwo);

            coinReturn.Clear();

            Assert.AreEqual(1, mockCoinReturnObserverOne.NumberOfTimesCoinPurseUpdatedCalled);
            Assert.AreEqual(1, mockCoinReturnObserverTwo.NumberOfTimesCoinPurseUpdatedCalled);
        }