/* * public FormulaFlags Flags * { * get * { * LazyInit(); * return _flags; * } * } */ private void LazyInit() { if (_initialized) { return; } _initialized = true; if (_biffVersion == 2) { // _flags = (FormulaFlags)ReadUInt16(0xF); _xNumValue = ReadDouble(0x7); _formulaType = FormulaValueType.Number; } else { // _flags = (FormulaFlags)ReadUInt16(0xE); var formulaValueExprO = ReadUInt16(0xC); if (formulaValueExprO != 0xFFFF) { _formulaType = FormulaValueType.Number; _xNumValue = ReadDouble(0x6); } else { // var formulaLength = ReadByte(0xF); var formulaValueByte1 = ReadByte(0x6); var formulaValueByte3 = ReadByte(0x8); switch (formulaValueByte1) { case 0x00: _formulaType = FormulaValueType.String; break; case 0x01: _formulaType = FormulaValueType.Boolean; _booleanValue = formulaValueByte3 != 0; break; case 0x02: _formulaType = FormulaValueType.Error; _errorValue = (CellError)formulaValueByte3; break; case 0x03: _formulaType = FormulaValueType.EmptyString; break; default: _formulaType = FormulaValueType.Unknown; break; } } } }
/// <summary> /// This method is used to test Cell Error related adapter requirements. /// </summary> /// <param name="instance">Specify the instance which need to be verified.</param> /// <param name="site">Specify the ITestSite instance.</param> public void VerifyCellError(CellError instance, ITestSite site) { // If the instance is not null and there are no parsing errors, then the Cell Error related adapter requirements can be directly captured. if (null == instance) { site.Assert.Fail("The instance of type CellError is null due to parsing error or type casting error."); } // Verify the stream object header related requirements. this.ExpectStreamObjectHeaderStart(instance.StreamObjectHeaderStart, instance.GetType(), site); // Directly capture requirement MS-FSSHTTPB_R634, if the header type is StreamObjectHeaderStart32bit. site.CaptureRequirementIfAreEqual<Type>( typeof(StreamObjectHeaderStart32bit), instance.StreamObjectHeaderStart.GetType(), "MS-FSSHTTPB", 634, @"[In Cell Error] Error Cell (4 bytes): A 32-bit stream object header (section 2.2.1.5.2) that specifies an error cell."); // Directly capture requirement MS-FSSHTTPB_R635, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 635, @"[In Cell Error] Error Code (4 bytes): An unsigned integer that specifies the error code."); bool cellErrorFlag = (CellErrorCode)instance.ErrorCode == CellErrorCode.Unknownerror || (CellErrorCode)instance.ErrorCode == CellErrorCode.InvalidObject || (CellErrorCode)instance.ErrorCode == CellErrorCode.Invalidpartition || (CellErrorCode)instance.ErrorCode == CellErrorCode.Requestnotsupported || (CellErrorCode)instance.ErrorCode == CellErrorCode.Storagereadonly || (CellErrorCode)instance.ErrorCode == CellErrorCode.RevisionIDnotfound || (CellErrorCode)instance.ErrorCode == CellErrorCode.Badtoken || (CellErrorCode)instance.ErrorCode == CellErrorCode.Requestnotfinished || (CellErrorCode)instance.ErrorCode == CellErrorCode.Incompatibletoken || (CellErrorCode)instance.ErrorCode == CellErrorCode.Scopedcellstorage || (CellErrorCode)instance.ErrorCode == CellErrorCode.Coherencyfailure || (CellErrorCode)instance.ErrorCode == CellErrorCode.Cellstoragestatedeserializationfailure || (CellErrorCode)instance.ErrorCode == CellErrorCode.Incompatibleprotocolversion || (CellErrorCode)instance.ErrorCode == CellErrorCode.Referenceddataelementnotfound || (CellErrorCode)instance.ErrorCode == CellErrorCode.Requeststreamschemaerror || (CellErrorCode)instance.ErrorCode == CellErrorCode.Responsestreamschemaerror || (CellErrorCode)instance.ErrorCode == CellErrorCode.Unknownrequest || (CellErrorCode)instance.ErrorCode == CellErrorCode.Storagefailure || (CellErrorCode)instance.ErrorCode == CellErrorCode.Storagewriteonly || (CellErrorCode)instance.ErrorCode == CellErrorCode.Invalidserialization || (CellErrorCode)instance.ErrorCode == CellErrorCode.Dataelementnotfound || (CellErrorCode)instance.ErrorCode == CellErrorCode.Invalidimplementation || (CellErrorCode)instance.ErrorCode == CellErrorCode.Incompatibleoldstorage || (CellErrorCode)instance.ErrorCode == CellErrorCode.Incompatiblenewstorage || (CellErrorCode)instance.ErrorCode == CellErrorCode.IncorrectcontextfordataelementID || (CellErrorCode)instance.ErrorCode == CellErrorCode.Objectgroupduplicateobjects || (CellErrorCode)instance.ErrorCode == CellErrorCode.Objectreferencenotfoundinrevision || (CellErrorCode)instance.ErrorCode == CellErrorCode.Mergecellstoragestateconflict || (CellErrorCode)instance.ErrorCode == CellErrorCode.Unknownquerychangesfilter || (CellErrorCode)instance.ErrorCode == CellErrorCode.Unsupportedquerychangesfilter || (CellErrorCode)instance.ErrorCode == CellErrorCode.Unabletoprovideknowledge || (CellErrorCode)instance.ErrorCode == CellErrorCode.DataelementmissingID || (CellErrorCode)instance.ErrorCode == CellErrorCode.Dataelementmissingserialnumber || (CellErrorCode)instance.ErrorCode == CellErrorCode.Requestargumentinvalid || (CellErrorCode)instance.ErrorCode == CellErrorCode.Partialchangesnotsupported || (CellErrorCode)instance.ErrorCode == CellErrorCode.Storebusyretrylater || (CellErrorCode)instance.ErrorCode == CellErrorCode.GUIDIDtablenotsupported || (CellErrorCode)instance.ErrorCode == CellErrorCode.Dataelementcycle || (CellErrorCode)instance.ErrorCode == CellErrorCode.Fragmentknowledgeerror || (CellErrorCode)instance.ErrorCode == CellErrorCode.Fragmentsizemismatch || (CellErrorCode)instance.ErrorCode == CellErrorCode.Fragmentsincomplete || (CellErrorCode)instance.ErrorCode == CellErrorCode.Fragmentinvalid || (CellErrorCode)instance.ErrorCode == CellErrorCode.Abortedafterfailedputchanges || (CellErrorCode)instance.ErrorCode == CellErrorCode.FailedNoUpgradeableContents || (CellErrorCode)instance.ErrorCode == CellErrorCode.UnableAllocateAdditionalExtendedGuids || (CellErrorCode)instance.ErrorCode == CellErrorCode.SiteReadonlyMode || (CellErrorCode)instance.ErrorCode == CellErrorCode.MultiRequestPartitionReachQutoa || (CellErrorCode)instance.ErrorCode == CellErrorCode.ExtendedGuidCollision || (CellErrorCode)instance.ErrorCode == CellErrorCode.InsufficientPermisssions || (CellErrorCode)instance.ErrorCode == CellErrorCode.ServerThrottling || (CellErrorCode)instance.ErrorCode == CellErrorCode.FileTooLarge; site.Assert.IsTrue( cellErrorFlag, "The error code value for the cell error MUST be 1~47, 79, 106, 108, 111, 112, 113, 114 and 115, but except 10, 14, 17, 30"); // Directly capture requirement MS-FSSHTTPB_R636, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 636, @"[In Cell Error] Error Code (4 bytes): The following table contains the possible error codes: [the value of Error Code must be (1~47,except 10, 14, 17, 30) and 79, 106, 108, 111~115]."); // Verify the compound related requirements. this.ExpectSingleObject(instance.StreamObjectHeaderStart, site); }