public void GetSiteStats_GetsValidStats_ReturnsValidObject() { var cache = mocks.DynamicMock<ICacheManager>(); cache.Stub(x => x.Contains("")).Constraints(Is.Anything()).Return(false); IDnaDataReaderCreator creator = mocks.DynamicMock<IDnaDataReaderCreator>(); creator.Stub(x => x.CreateDnaDataReader("fetchsitedata")).Return(GetSiteListMockReader()); creator.Stub(x => x.CreateDnaDataReader("getreviewforums")).Return(GetReviewForumsMockReader()); creator.Stub(x => x.CreateDnaDataReader("getkeyarticlelist")).Return(GetKeyArticleListMockReader()); creator.Stub(x => x.CreateDnaDataReader("getsitetopicsopenclosetimes")).Return(GetSiteOpenCloseTimesMockReader()); creator.Stub(x => x.CreateDnaDataReader("GetTopicDetails")).Return(GetSiteTopicsMockReader()); creator.Stub(x => x.CreateDnaDataReader("getallsiteoptions")).Return(SiteOptionListTest.GetBoolSiteOptionMockReader()); IDnaDiagnostics diag = mocks.DynamicMock<IDnaDiagnostics>(); mocks.ReplayAll(); SiteList siteList = new SiteList(creator, diag, cache, null, null); var stats = siteList.GetStats(typeof(SiteList)); Assert.IsNotNull(stats); Assert.AreEqual(typeof(SiteList).AssemblyQualifiedName, stats.Name); Assert.AreEqual(siteList.GetObjectFromCache().Ids.Count.ToString(), stats.Values["NumberOfSites"]); Assert.AreEqual(siteList.GetObjectFromCache().SiteOptionList.GetAllOptions().Count.ToString(), stats.Values["NumberOfSiteOptions"]); }