public void EnableTeamFeatures_ExceptionUpdate_ReturnsFalse() { // Arrange var countGetField = 0; var list = new ShimSPList() { FieldsGet = () => new ShimSPFieldCollection() { GetFieldByInternalNameString = internalName => { if (countGetField == 0) { countGetField++; return(null); } return(new ShimSPField() { Update = () => { throw new Exception(); } }); }, AddStringSPFieldTypeBoolean = (displayName, type, required) => string.Empty } }; // Act var actualResult = ListCommands.EnableTeamFeatures(list); // Assert actualResult.ShouldBeFalse(); }
public void EnableTeamFeatures_Updated_ReturnsTrue() { // Arrange var actualUpdatedField = false; var countGetField = 0; var list = new ShimSPList() { FieldsGet = () => new ShimSPFieldCollection() { GetFieldByInternalNameString = internalName => { if (countGetField == 0) { countGetField++; return(null); } return(new ShimSPField() { Update = () => actualUpdatedField = true }); }, AddStringSPFieldTypeBoolean = (displayName, type, required) => string.Empty } }; // Act var actualResult = ListCommands.EnableTeamFeatures(list); // Assert this.ShouldSatisfyAllConditions( () => actualResult.ShouldBeTrue(), () => actualUpdatedField.ShouldBeTrue()); }
public void EnableTeamFeatures_Found_ReturnsTrue() { // Arrange var list = new ShimSPList() { FieldsGet = () => new ShimSPFieldCollection() { GetFieldByInternalNameString = internalName => new ShimSPField() } }; // Act var actualResult = ListCommands.EnableTeamFeatures(list); // Assert actualResult.ShouldBeTrue(); }