public void CallsInnerJustOnce()
        {
            var innerMapper = new MReadOnlyMappingManager();

            innerMapper.getFields += t => {
                Assert.AreEqual(typeof(TestDocument), t);
                return(new Dictionary <string, SolrFieldModel> {
                    { "id", new SolrFieldModel(property: typeof(TestDocument).GetProperty("Id"), fieldName: "id") },
                });
            };
            var mapper = new MemoizingMappingManager(innerMapper);

            mapper.GetFields(typeof(TestDocument));
            mapper.GetFields(typeof(TestDocument));
            Assert.AreEqual(1, innerMapper.getFields.Calls);
        }
        public void CallsInnerJustOnce()
        {
            var mocks       = new MockRepository();
            var innerMapper = mocks.StrictMock <IReadOnlyMappingManager>();

            With.Mocks(mocks)
            .Expecting(() => Expect.Call(innerMapper.GetFields(typeof(TestDocument)))
                       .Repeat.Once()
                       .Return(new Dictionary <string, SolrFieldModel> {
                { "id", new SolrFieldModel {
                      Property = typeof(TestDocument).GetProperty("Id"), FieldName = "id"
                  } },
            }))
            .Verify(() => {
                var mapper = new MemoizingMappingManager(innerMapper);
                mapper.GetFields(typeof(TestDocument));
                mapper.GetFields(typeof(TestDocument));
            });
        }