public void EnableTimesheets_Should_UpdateFields() { // Arrange var countUpdatedField = 0; var countUpdatedContentType = 0; var countUpdatedList = 0; var actualEpmLiveTsLists = string.Empty; var list = new ShimSPList() { FieldsGet = () => new ShimSPFieldCollection() { GetFieldByInternalNameString = internalName => new ShimSPField() { Update = () => countUpdatedField++ } }, ContentTypesGet = () => new ShimSPContentTypeCollection() { ItemGetString = itemName => new ShimSPContentType() { FieldLinksGet = () => new ShimSPFieldLinkCollection() { ItemGetGuid = guid => null }, Update = () => countUpdatedContentType++ } }, Update = () => countUpdatedList++, TitleGet = () => DummyTitle }; var web = new ShimSPWeb() { SiteGet = () => new ShimSPSite() { RootWebGet = () => new ShimSPWeb() } }; ShimSPFieldLink.ConstructorSPField = (sender, spField) => new ShimSPFieldLink(); ShimCoreFunctions.getConfigSettingSPWebString = (rootWeb, setting) => string.Empty; ShimCoreFunctions.setConfigSettingSPWebStringString = (rootWeb, setting, value) => actualEpmLiveTsLists = value; // Act ListCommands.EnableTimesheets(list, web); // Assert this.ShouldSatisfyAllConditions( () => countUpdatedField.ShouldBe(2), () => countUpdatedContentType.ShouldBe(2), () => countUpdatedList.ShouldBe(1), () => actualEpmLiveTsLists.ShouldBe($"\r\n{DummyTitle}")); }