示例#1
0
        public void GetWordEnumeratorTest()
        {
            IMemory target = new MemoryBasic();
            target.Init(10);

            IEnumerator<Word> actual = target.GetEnumerator();
            int i = 0;

            Word w = null;
            actual.Reset();
            while (actual.MoveNext())
            {
                w = actual.Current;
                i++;
            }

            Assert.AreEqual(5,i);
        }
示例#2
0
        public void GetWordTest()
        {
            MockRepository mocks = new MockRepository();

            var wordMock = MockRepository.GenerateStub<IWord>();

            wordMock.Stub(x => x.UValue).Return(10);

            MemoryBasic target = new MemoryBasic();

            target.Init(16);

            int address = 4;

            target.SetWord(address, wordMock);

            IWord current = target.GetWord(address);

            Assert.AreEqual(wordMock.UValue, current.UValue);
        }