コード例 #1
0
        public void GetRegistered()
        {
            var innerMapper = new MReadOnlyMappingManager();

            innerMapper.getRegisteredTypes += () => new[] { typeof(TestDocument) };
            var mapper = new MemoizingMappingManager(innerMapper);
            var types  = mapper.GetRegisteredTypes();

            Assert.AreEqual(1, types.Count);
            Assert.AreEqual(typeof(TestDocument), types.First());
            mapper.GetRegisteredTypes();
        }
コード例 #2
0
        public void GetRegistered()
        {
            var innerMapper = MockRepository.GenerateMock <IReadOnlyMappingManager>();

            innerMapper.Expect(x => x.GetRegisteredTypes()).Repeat.Once().Return(new[] { typeof(TestDocument) });
            var mapper = new MemoizingMappingManager(innerMapper);
            var types  = mapper.GetRegisteredTypes();

            Assert.AreEqual(1, types.Count);
            Assert.AreEqual(typeof(TestDocument), types.First());
            types = mapper.GetRegisteredTypes();
            innerMapper.VerifyAllExpectations();
        }