public void InstallListsViewsWebParts_FoundGridListView_AddGridView() { // Arrange var actualAddedGridView = false; var actualDisposeWeb = false; var spList = new ShimSPList() { BaseTemplateGet = () => SPListTemplateType.AccessApp, ParentWebGet = () => new ShimSPWeb() { GetFileString = strUrl => new ShimSPFile() { ExistsGet = () => true, GetLimitedWebPartManagerPersonalizationScope = scope => new ShimSPLimitedWebPartManager() { WebPartsGet = () => new ShimSPLimitedWebPartCollection().Bind( new WebPart[] { new ShimWebPart(new ShimGridListView().Instance) }), AddWebPartWebPartStringInt32 = (webPart, zoneId, zoneIndex) => { if (webPart.GetType() == typeof(GridListView)) { actualAddedGridView = true; } }, WebGet = () => new ShimSPWeb() { Dispose = () => actualDisposeWeb = true } } } }, ViewsGet = () => new ShimSPViewCollection().Bind( new SPView[] { new ShimSPView() { UrlGet = () => DummyUrl } }) }; // Act ListCommands.InstallListsViewsWebparts(spList); // Assert this.ShouldSatisfyAllConditions( () => actualAddedGridView.ShouldBeFalse(), () => actualDisposeWeb.ShouldBeTrue()); }