public static void WriteTo( IObjectWriter writer, ProtoBufNetTestObject obj) { if (null == obj) { writer.WriteNullValue(); return; } writer.WriteStartObject(); writer.WriteStartMember(1); writer.WriteValue(obj.Foo); writer.WriteEndMember(); writer.WriteStartMember(2); writer.WriteValue(obj.Bar); writer.WriteEndMember(); writer.WriteStartMember(3); writer.WriteValue(obj.Blip); writer.WriteEndMember(); writer.WriteStartMember(4); writer.WriteValue(obj.Blop); writer.WriteEndMember(); writer.WriteEndObject(); }
public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null) { Contract.Assert(this.output != null); Contract.Assert(this.commandLineOptions != null); Contract.Assert(!string.IsNullOrWhiteSpace(this.runSettingsManager?.ActiveRunSettings?.SettingsXml)); if (this.commandLineOptions.Sources.Count() <= 0) { throw new CommandLineException(string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MissingTestSourceFile)); } this.output.WriteLine(CommandLineResources.ListTestsHeaderMessage, OutputLevel.Information); if (!string.IsNullOrEmpty(EqtTrace.LogFile)) { this.output.Information(false, CommandLineResources.VstestDiagLogOutputPath, EqtTrace.LogFile); } var runSettings = this.runSettingsManager.ActiveRunSettings.SettingsXml; this.discoveryEventsRegistrar.ObjectWriter = objectWriter; this.testRequestManager.TestPlatformEventSourceInstance = testPlatformEventSource; this.testRequestManager.DiscoverTests( new DiscoveryRequestPayload() { Sources = this.commandLineOptions.Sources, RunSettings = runSettings }, this.discoveryEventsRegistrar, Constants.DefaultProtocolConfig); return(ArgumentProcessorResult.Success); }
private static void LogFilters(HttpContext httpContext, IObjectWriter obj) { var app = httpContext.Context().App; if (app != null) { obj.WriteProperty("appId", app.Id.ToString()); obj.WriteProperty("appName", app.Name); } var userId = httpContext.User.OpenIdSubject(); if (!string.IsNullOrWhiteSpace(userId)) { obj.WriteProperty(nameof(userId), userId); } var clientId = httpContext.User.OpenIdClientId(); if (!string.IsNullOrWhiteSpace(clientId)) { obj.WriteProperty(nameof(clientId), clientId); } var costs = httpContext.Features.Get <IApiCostsFeature>()?.Costs ?? 0; obj.WriteProperty(nameof(costs), costs); }
public ValueWriter(IDocumentWriter ownerDocument, IObjectWriter[] objectWriters, IBaseTypeMembersWriter[] baseTypeMembersWriters) { this.ownerDocument = ownerDocument; writers = objectWriters; this.baseTypeMembersWriters = baseTypeMembersWriters; }
private static void SetWarningProperties(IObjectWriter writer, ProjectRestoreMetadata msbuildMetadata) { if (msbuildMetadata.ProjectWideWarningProperties != null && (msbuildMetadata.ProjectWideWarningProperties.AllWarningsAsErrors || msbuildMetadata.ProjectWideWarningProperties.NoWarn.Count > 0 || msbuildMetadata.ProjectWideWarningProperties.WarningsAsErrors.Count > 0)) { writer.WriteObjectStart("warningProperties"); SetValueIfTrue(writer, "allWarningsAsErrors", msbuildMetadata.ProjectWideWarningProperties.AllWarningsAsErrors); if (msbuildMetadata.ProjectWideWarningProperties.NoWarn.Count > 0) { SetArrayValue(writer, "noWarn", msbuildMetadata .ProjectWideWarningProperties .NoWarn .ToArray() .OrderBy(c => c) .Select(c => c.GetName())); } if (msbuildMetadata.ProjectWideWarningProperties.WarningsAsErrors.Count > 0) { SetArrayValue(writer, "warnAsError", msbuildMetadata .ProjectWideWarningProperties .WarningsAsErrors .ToArray() .OrderBy(c => c) .Select(c => c.GetName())); } writer.WriteObjectEnd(); } }
public NonNativeObjectWriter(IObjectWriter objectWriter, IStorageEngine storageEngine) { _objectWriter = objectWriter; _session = storageEngine.GetSession(); _objectReader = storageEngine.GetObjectReader(); _storageEngine = storageEngine; }
public static void WriteRuntimeGraph(IObjectWriter writer, RuntimeGraph runtimeGraph) { if (runtimeGraph != null) { if (runtimeGraph.Runtimes.Any() == true) { writer.WriteObjectStart("runtimes"); var sortedRuntimes = runtimeGraph.Runtimes.Values .OrderBy(runtime => runtime.RuntimeIdentifier, StringComparer.Ordinal); foreach (var runtime in sortedRuntimes) { WriteRuntimeDescription(writer, runtime); } writer.WriteObjectEnd(); } if (runtimeGraph.Supports.Any() == true) { writer.WriteObjectStart("supports"); var sortedSupports = runtimeGraph.Supports.Values .OrderBy(runtime => runtime.Name, StringComparer.Ordinal); foreach (var support in sortedSupports) { WriteCompatibilityProfile(writer, support); } writer.WriteObjectEnd(); } } }
/// <summary> /// Execute specific tests that match any of the given strings. /// </summary> /// <returns></returns> public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null) { Contract.Assert(this.output != null); Contract.Assert(this.commandLineOptions != null); Contract.Assert(this.testRequestManager != null); Contract.Assert(!string.IsNullOrWhiteSpace(this.runSettingsManager.ActiveRunSettings.SettingsXml)); if (!this.commandLineOptions.Sources.Any()) { throw new CommandLineException(string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MissingTestSourceFile)); } this.effectiveRunSettings = this.runSettingsManager.ActiveRunSettings.SettingsXml; ((TestRequestManager)this.testRequestManager).VSTestLoggerManager = this.VSTestLoggerManager = vsTestLogManager; // Discover tests from sources and filter on every discovery reported. this.DiscoverTestsAndSelectSpecified(this.commandLineOptions.Sources); this.testRequestManager.TestPlatformEventSourceInstance = testPlatformEventSource; // Now that tests are discovered and filtered, we run only those selected tests. this.ExecuteSelectedTests(); bool treatNoTestsAsError = RunSettingsUtilities.GetTreatNoTestsAsError(effectiveRunSettings); if (treatNoTestsAsError && this.selectedTestCases.Count == 0) { return(ArgumentProcessorResult.Fail); } return(ArgumentProcessorResult.Success); }
private static void SetValue(IObjectWriter writer, string name, string value) { if (value != null) { writer.WriteNameValue(name, value); } }
private static void WriteMetadataBooleans(IObjectWriter writer, ProjectRestoreMetadata msbuildMetadata) { SetValueIfTrue(writer, "crossTargeting", msbuildMetadata.CrossTargeting); SetValueIfTrue(writer, "legacyPackagesDirectory", msbuildMetadata.LegacyPackagesDirectory); SetValueIfTrue(writer, "validateRuntimeAssets", msbuildMetadata.ValidateRuntimeAssets); SetValueIfTrue(writer, "skipContentFileWrite", msbuildMetadata.SkipContentFileWrite); }
private static void SetCentralDependencies(IObjectWriter writer, ICollection <CentralPackageVersion> centralPackageVersions, bool hashing) { if (!centralPackageVersions.Any()) { return; } writer.WriteObjectStart("centralPackageVersions"); if (hashing) { foreach (var dependency in centralPackageVersions) { writer.WriteNameValue(name: dependency.Name, value: dependency.VersionRange.OriginalString ?? dependency.VersionRange.ToNormalizedString()); } } else { foreach (var dependency in centralPackageVersions.OrderBy(dep => dep.Name)) { writer.WriteNameValue(name: dependency.Name, value: dependency.VersionRange.ToNormalizedString()); } } writer.WriteObjectEnd(); }
public void Append(IObjectWriter logEntry) { if (_actionContextAccessor.ActionContext?.HttpContext is {} context) { DumpRequestHeader(context, logEntry); } }
private static void SetFrameworkReferences(IObjectWriter writer, ISet <string> frameworkReferences) { if (frameworkReferences?.Any() == true) { writer.WriteNameArray("frameworkReferences", frameworkReferences.OrderBy(e => e)); } }
public DestinationWriter(string address, IObjectSource source, IObjectWriter writer, IObjectWriterLocker locker) { Address = address ?? throw new ArgumentNullException(nameof(address)); _source = source ?? throw new ArgumentNullException(nameof(source)); _writer = writer ?? throw new ArgumentNullException(nameof(writer)); _locker = locker ?? throw new ArgumentNullException(nameof(locker)); }
private static void SetArrayValue(IObjectWriter writer, string name, IEnumerable <string> values) { if (values != null && values.Any()) { writer.WriteNameArray(name, values); } }
public void Append(IObjectWriter writer) { var actionContext = actionContextAccessor.ActionContext; if (actionContext == null) { return; } var httpContext = actionContext.HttpContext; Guid requestId; if (httpContext.Items.TryGetValue(nameof(requestId), out var value) && value is Guid requestIdValue) { requestId = requestIdValue; } else { httpContext.Items[nameof(requestId)] = requestId = Guid.NewGuid(); } writer.WriteObject("web", w => w .WriteProperty("requestId", requestId.ToString()) .WriteProperty("requestPath", httpContext.Request.Path) .WriteProperty("requestMethod", httpContext.Request.Method) .WriteObject("routeValues", r => { foreach (var kvp in actionContext.ActionDescriptor.RouteValues) { r.WriteProperty(kvp.Key, kvp.Value); } })); }
private static void SetFrameworks(IObjectWriter writer, IList <TargetFrameworkInformation> frameworks) { if (frameworks.Any()) { writer.WriteObjectStart("frameworks"); var frameworkSorter = new NuGetFrameworkSorter(); foreach (var framework in frameworks.OrderBy(c => c.FrameworkName, frameworkSorter)) { writer.WriteObjectStart(framework.FrameworkName.GetShortFolderName()); SetDependencies(writer, framework.Dependencies); SetCentralDependencies(writer, framework.CentralPackageVersions.Values); SetImports(writer, framework.Imports); SetValueIfTrue(writer, "assetTargetFallback", framework.AssetTargetFallback); SetValueIfTrue(writer, "warn", framework.Warn); SetDownloadDependencies(writer, framework.DownloadDependencies); SetFrameworkReferences(writer, framework.FrameworkReferences); SetValueIfNotNull(writer, "runtimeIdentifierGraphPath", framework.RuntimeIdentifierGraphPath); writer.WriteObjectEnd(); } writer.WriteObjectEnd(); } }
private static void SetValueIfNotNull(IObjectWriter writer, string name, string value) { if (!string.IsNullOrEmpty(value)) { writer.WriteNameValue(name, value); } }
public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null) { Contract.Assert(this.output != null); Contract.Assert(this.commandLineOptions != null); Contract.Assert(!string.IsNullOrWhiteSpace(this.runSettingsManager?.ActiveRunSettings?.SettingsXml)); if (this.commandLineOptions.Sources.Count() <= 0) { throw new CommandLineException(string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MissingTestSourceFile)); } if (!string.IsNullOrEmpty(EqtTrace.LogFile)) { this.output.Information(false, CommandLineResources.VstestDiagLogOutputPath, EqtTrace.LogFile); } var runSettings = this.runSettingsManager.ActiveRunSettings.SettingsXml; this.testRequestManager.DiscoverTests( new DiscoveryRequestPayload { Sources = this.commandLineOptions.Sources, RunSettings = runSettings }, this.discoveryEventsRegistrar, Constants.DefaultProtocolConfig); if (string.IsNullOrEmpty(this.commandLineOptions.ListTestsTargetPath)) { // This string does not need to go to Resources. Reason - only internal consumption throw new CommandLineException("Target Path should be specified for listing FQDN tests!"); } File.WriteAllLines(this.commandLineOptions.ListTestsTargetPath, this.discoveredTests); return(ArgumentProcessorResult.Success); }
/// <summary> /// The central transitive dependecy groups are used for pack operation. /// The metadata needed for pack is composed from: /// Name, IncludeType, SuppressParent and Version /// </summary> internal static void SetCentralTransitveDependencyGroup(IObjectWriter writer, string name, IEnumerable <LibraryDependency> libraryDependencies) { if (!libraryDependencies.Any()) { return; } writer.WriteObjectStart(name); foreach (var dependency in libraryDependencies.OrderBy(e => e.Name, StringComparer.Ordinal)) { var versionRange = dependency.LibraryRange.VersionRange ?? VersionRange.All; var versionString = versionRange.ToNormalizedString(); writer.WriteObjectStart(dependency.Name); if (dependency.IncludeType != LibraryIncludeFlags.All) { SetValue(writer, "include", dependency.IncludeType.ToString()); } if (dependency.SuppressParent != LibraryIncludeFlagUtils.DefaultSuppressParent) { SetValue(writer, "suppressParent", dependency.SuppressParent.ToString()); } SetValue(writer, "version", versionString); writer.WriteObjectEnd(); } writer.WriteObjectEnd(); }
public void Append(IObjectWriter writer, SemanticLogLevel logLevel, Exception?exception) { if (exception != null && exception is not DomainException) { logger.Log(exception, httpContextWrapper); } }
public void Append(IObjectWriter writer, SemanticLogLevel logLevel, Exception?exception) { var httpContext = httpContextAccessor.HttpContext; if (string.IsNullOrEmpty(httpContext?.Request?.Method)) { return; } var requestId = GetRequestId(httpContext); var logContext = (requestId, context : httpContext, actionContextAccessor); writer.WriteObject("web", logContext, (ctx, w) => { w.WriteProperty("requestId", ctx.requestId); w.WriteProperty("requestPath", ctx.context.Request.Path); w.WriteProperty("requestMethod", ctx.context.Request.Method); var actionContext = ctx.actionContextAccessor.ActionContext; if (actionContext != null) { w.WriteObject("routeValues", actionContext.ActionDescriptor.RouteValues, (routeValues, r) => { foreach (var(key, value) in routeValues) { r.WriteProperty(key, value); } });
public void Append(IObjectWriter writer) { writer.WriteObject("app", w => w .WriteProperty("name", applicationName) .WriteProperty("version", applicationVersion) .WriteProperty("sessionId", applicationSessionId)); }
public void Clear() { _objectReader = null; _objectWriter = null; _lastIdPositions = null; _lastIds = null; }
private static void SetValueIfTrue(IObjectWriter writer, string name, bool value) { if (value) { writer.WriteNameValue(name, value); } }
/// <summary> /// The database file name /// </summary> public StorageEngine(IDbIdentification parameters) { _reflectionService = DependencyContainer.Resolve <IReflectionService>(); try { var metaModelCompabilityChecker = DependencyContainer.Resolve <IMetaModelCompabilityChecker>(); DbIdentification = parameters; IsDbClosed = false; var isNewDatabase = DbIdentification.IsNew(); _session = DependencyContainer.Resolve <ISession>(this); // Object Writer must be created before object Reader _objectWriter = DependencyContainer.Resolve <IObjectWriter>(this); ObjectReader = DependencyContainer.Resolve <IObjectReader>(this); // Associate current session to the fsi -> all transaction writes // will be applied to this FileSystemInterface _session.SetFileSystemInterfaceToApplyTransaction(_objectWriter.FileSystemProcessor.FileSystemInterface); _objectIntrospectionDataProvider = new SessionDataProvider(_session); if (isNewDatabase) { _objectWriter.CreateEmptyDatabaseHeader(OdbTime.GetCurrentTimeInTicks()); } else { GetObjectReader().ReadDatabaseHeader(); } _objectWriter.AfterInit(); _objectIntrospector = new ObjectIntrospector(GetClassInfoProvider()); _triggerManager = GetLocalTriggerManager(); // This forces the initialization of the meta model var metaModel = GetMetaModel(); var shouldUpdate = metaModelCompabilityChecker.Check(ClassIntrospector.Instrospect(metaModel.GetAllClasses()), GetMetaModel()); if (shouldUpdate) { UpdateMetaModel(); } _objectWriter.SetTriggerManager(_triggerManager); _introspectionCallbackForInsert = new InstrumentationCallbackForStore(_triggerManager, false); _introspectionCallbackForUpdate = new InstrumentationCallbackForStore(_triggerManager, true); } catch { if (parameters is FileIdentification) { Monitor.Exit(string.Intern(Path.GetFullPath(parameters.FileName))); } throw; } }
public DictionaryWriter(IDocumentWriter ownerDocument, IValuesCache valuesCache, IObjectWriter objectWriter, ITypeNamesCache typeNamesCache) { this.ownerDocument = ownerDocument; this.valuesCache = valuesCache; this.objectWriter = objectWriter; this.typeNamesCache = typeNamesCache; }
protected override void SetUp() { base.SetUp(); ownerDocument = NewMock <IDocumentWriter>(); writer = new PrimitiveValueTypeXmlWriter(ownerDocument); }
protected override void SetUp() { base.SetUp(); ownerDocument = NewMock <IDocumentWriter>(); writer = new NullValueWriter(ownerDocument); }
internal static void Write( IObjectWriter objectWriter, TemplateToken value) { objectWriter.WriteStart(); WriteValue(objectWriter, value); objectWriter.WriteEnd(); }
protected MapReduce() { _outWriter = GetOutWriter(); _inReader = GetInReader(); _keySerializer = GetKeySerializer(); _valueSerializer = GetValueSerializer(); _outSerializer = GetOutSerializer(); }
public static IObjectWriter WriteException(this IObjectWriter writer, Exception exception) { return(writer.WriteObject(nameof(exception), inner => { inner.WriteProperty("message", exception.Message); inner.WriteProperty("stackTrace", exception.StackTrace); })); }
public ListWriter(Type listType, IDocumentWriter ownerDocument, IValuesCache valuesCache, IObjectWriter objectWriter, ITypeNamesCache typeNamesCache) { this.listType = listType; this.ownerDocument = ownerDocument; this.valuesCache = valuesCache; this.objectWriter = objectWriter; this.typeNamesCache = typeNamesCache; }
protected override void SetUp() { base.SetUp(); ownerDocument = NewMock<IDocumentWriter>(); objectWriter = NewMock<IObjectWriter>(); writer = GetWriter(); }
protected override void SetUp() { base.SetUp(); ownerDocument = NewMock<IDocumentWriter>(); objectWriter = NewMock<IObjectWriter>(); writer = new MemberWriter(ownerDocument, objectWriter); }
protected override void SetUp() { base.SetUp(); valuesCache = NewMock<IValuesCache>(); document = NewMock<IDocumentWriter>(); writer = new ObjectReferenceWriter(document, valuesCache); }
public static void WriteTo( IObjectWriter writer, EmptyObject emptyObject) { if (null == emptyObject) { writer.WriteNullValue(); return; } writer.WriteStartObject(); writer.WriteEndObject(); }
/// <param name="objectWriter"> The object writer </param> /// <param name="objectReader"> The object reader </param> /// <param name="currentIdBlock">Current Id block data </param> public IdManager(IObjectWriter objectWriter, IObjectReader objectReader, CurrentIdBlockInfo currentIdBlock) { _objectWriter = objectWriter; _objectReader = objectReader; _currentBlockIdPosition = currentIdBlock.CurrentIdBlockPosition; _currentBlockIdNumber = currentIdBlock.CurrentIdBlockNumber; _maxId = new ObjectOID((long)currentIdBlock.CurrentIdBlockNumber * StorageEngineConstant.NbIdsPerBlock); _nextId = new ObjectOID(currentIdBlock.CurrentIdBlockMaxOid.ObjectId + 1); _lastIds = new OID[IdBufferSize]; for (var i = 0; i < IdBufferSize; i++) _lastIds[i] = StorageEngineConstant.NullObjectId; _lastIdPositions = new long[IdBufferSize]; _lastIdIndex = 0; }
public static void SerializePerson(Person person, IObjectWriter writer) { if (person == null) { writer.WriteNullValue(); } else { writer.WriteStartObject(); writer.WriteMember(1, person.Id); writer.WriteMember(2, person.Name); writer.WriteMember(3, person.Scores); writer.WriteEndObject(); } }
public static void WriteTo( IObjectWriter writer, JsonNetSimpleObject obj) { if (null == obj) { writer.WriteNullValue(); return; } writer.WriteStartObject(); writer.WriteMember(1, obj.Id); writer.WriteMember(2, obj.Name); writer.WriteMember(3, obj.Address); writer.WriteMember(4, obj.Scores); writer.WriteEndObject(); }
public static void WriteTo( IObjectWriter writer, ComplexObject complexObject) { if (null == complexObject) { writer.WriteNullValue(); return; } writer.WriteStartObject(); // Nested object writer.WriteStartMember(MemberKey.NestedObject); SimpleObject.WriteTo(writer, complexObject.NestedObject); writer.WriteEndMember(); // Nested object (write-only) writer.WriteStartMember(MemberKey.WriteOnlyNestedObject); SimpleObject.WriteTo(writer, complexObject.NestedObject); writer.WriteEndMember(); // Nested empty object writer.WriteStartMember(MemberKey.NestedEmptyObject); EmptyObject.WriteTo(writer, complexObject.NestedEmptyObject); writer.WriteEndMember(); // Nested empty object (write-only) writer.WriteStartMember(MemberKey.WriteOnlyNestedEmptyObject); SimpleObject.WriteTo(writer, complexObject.NestedNullObject); writer.WriteEndMember(); // Nested null object writer.WriteStartMember(MemberKey.NestedNullObject); SimpleObject.WriteTo(writer, complexObject.NestedNullObject); writer.WriteEndMember(); // Nested null object (write-only) writer.WriteStartMember(MemberKey.WriteOnlyNestedNullObject); SimpleObject.WriteTo(writer, complexObject.NestedNullObject); writer.WriteEndMember(); // Array of objects WriteMember(writer, MemberKey.ArrayOfObjects, complexObject.ArrayOfObjects); WriteMember(writer, MemberKey.WriteOnlyArrayOfObjects, complexObject.ArrayOfObjects); // Empty array of objects WriteMember(writer, MemberKey.EmptyArrayOfObjects, complexObject.EmptyArrayOfObjects); WriteMember(writer, MemberKey.WriteOnlyEmptyArrayOfObjects, complexObject.EmptyArrayOfObjects); // Null array of objects WriteMember(writer, MemberKey.NullArrayOfObjects, complexObject.NullArrayOfObjects); WriteMember(writer, MemberKey.WriteOnlyNullArrayOfObjects, complexObject.NullArrayOfObjects); // Nested array of ints WriteMember(writer, MemberKey.NestedArrayOfInts, complexObject.NestedArrayOfInts); WriteMember(writer, MemberKey.WriteOnlyNestedArrayOfInts, complexObject.NestedArrayOfInts); // Empty nested array of ints WriteMember(writer, MemberKey.NestedEmptyArrayOfInts, complexObject.NestedEmptyArrayOfInts); WriteMember(writer, MemberKey.WriteOnlyNestedEmptyArrayOfInts, complexObject.NestedEmptyArrayOfInts); // Null nested array of ints WriteMember(writer, MemberKey.NestedNullArrayOfInts, complexObject.NestedNullArrayOfInts); WriteMember(writer, MemberKey.WriteOnlyNestedNullArrayOfInts, complexObject.NestedNullArrayOfInts); // Nested array of strings WriteMember(writer, MemberKey.NestedArrayOfStrings, complexObject.NestedArrayOfStrings); WriteMember(writer, MemberKey.WriteOnlyNestedArrayOfStrings, complexObject.NestedArrayOfStrings); // Empty nested array of strings WriteMember(writer, MemberKey.NestedEmptyArrayOfStrings, complexObject.NestedEmptyArrayOfStrings); WriteMember(writer, MemberKey.WriteOnlyNestedEmptyArrayOfStrings, complexObject.NestedEmptyArrayOfStrings); // Null nested array of strings WriteMember(writer, MemberKey.NestedNullArrayOfStrings, complexObject.NestedNullArrayOfStrings); WriteMember(writer, MemberKey.WriteOnlyNestedNullArrayOfStrings, complexObject.NestedNullArrayOfStrings); // Nested array of objects WriteMember(writer, MemberKey.NestedArrayOfObjects, complexObject.NestedArrayOfObjects); WriteMember(writer, MemberKey.WriteOnlyNestedArrayOfObjects, complexObject.NestedArrayOfObjects); // Empty nested array of objects WriteMember(writer, MemberKey.NestedEmptyArrayOfObjects, complexObject.NestedEmptyArrayOfObjects); WriteMember(writer, MemberKey.WriteOnlyNestedEmptyArrayOfObjects, complexObject.NestedEmptyArrayOfObjects); // Null nested array of objects WriteMember(writer, MemberKey.NestedNullArrayOfObjects, complexObject.NestedNullArrayOfObjects); WriteMember(writer, MemberKey.WriteOnlyNestedNullArrayOfObjects, complexObject.NestedNullArrayOfObjects); writer.WriteEndObject(); }
protected override void SetUp() { base.SetUp(); ownerDocument = NewMock<IDocumentWriter>(); valueCache = NewMock<IValuesCache>(); objectWriter = NewMock<IObjectWriter>(); typeNamesCache = NewMock<ITypeNamesCache>(); writer = new ArrayOfObjectsWriter(ownerDocument, valueCache, objectWriter, typeNamesCache); }
protected override void SetUp() { base.SetUp(); ownerDocument = NewMock<IDocumentWriter>(); writer = new PrimitiveValueTypeXmlWriter(ownerDocument); }
protected override void SetUp() { base.SetUp(); ownerDocument = NewMock<IDocumentWriter>(); typeNamesCache = NewMock<ITypeNamesCache>(); writer = new EnumXmlWriter(ownerDocument, typeNamesCache); }
public static void WriteTo( IObjectWriter writer, SimpleObject simpleObject) { if (null == simpleObject) { writer.WriteNullValue(); return; } writer.WriteStartObject(); // String writer.WriteMember(MemberKey.StringValue, simpleObject.StringValue); writer.WriteMember(MemberKey.WriteOnlyStringValue, simpleObject.StringValue); // Empty String writer.WriteMember(MemberKey.StringEmptyValue, simpleObject.StringEmptyValue); writer.WriteMember(MemberKey.WriteOnlyStringEmptyValue, simpleObject.StringEmptyValue); // Null String writer.WriteMember(MemberKey.StringNullValue, simpleObject.StringNullValue); writer.WriteMember(MemberKey.WriteOnlyStringNullValue, simpleObject.StringNullValue); // Byte[] writer.WriteMember(MemberKey.ByteArrayValue, simpleObject.ByteArrayValue); writer.WriteMember(MemberKey.WriteOnlyByteArrayValue, simpleObject.ByteArrayValue); // Empty Byte[] writer.WriteMember(MemberKey.ByteArrayEmptyValue, simpleObject.ByteArrayEmptyValue); writer.WriteMember(MemberKey.WriteOnlyByteArrayEmptyValue, simpleObject.ByteArrayEmptyValue); // Null Byte[] writer.WriteMember(MemberKey.ByteArrayNullValue, simpleObject.ByteArrayNullValue); writer.WriteMember(MemberKey.WriteOnlyByteArrayNullValue, simpleObject.ByteArrayNullValue); // 0 Int writer.WriteMember(MemberKey.Int32ZeroValue, simpleObject.Int32ZeroValue); writer.WriteMember(MemberKey.WriteOnlyInt32ZeroValue, simpleObject.Int32ZeroValue); // Min Int writer.WriteMember(MemberKey.Int32MinValue, simpleObject.Int32MinValue); writer.WriteMember(MemberKey.WriteOnlyInt32MinValue, simpleObject.Int32MinValue); // Max Int writer.WriteMember(MemberKey.Int32MaxValue, simpleObject.Int32MaxValue); writer.WriteMember(MemberKey.WriteOnlyInt32MaxValue, simpleObject.Int32MaxValue); // Min UInt32 writer.WriteMember(MemberKey.UInt32MinValue, simpleObject.UInt32MinValue); writer.WriteMember(MemberKey.WriteOnlyUInt32MinValue, simpleObject.UInt32MinValue); // Max UInt32 writer.WriteMember(MemberKey.UInt32MaxValue, simpleObject.UInt32MaxValue); writer.WriteMember(MemberKey.WriteOnlyUInt32MaxValue, simpleObject.UInt32MaxValue); // Single writer.WriteMember(MemberKey.SingleValue, simpleObject.SingleValue); writer.WriteMember(MemberKey.WriteOnlySingleValue, simpleObject.SingleValue); // Min Single writer.WriteMember(MemberKey.SingleMinValue, simpleObject.SingleMinValue); writer.WriteMember(MemberKey.WriteOnlySingleMinValue, simpleObject.SingleMinValue); // Max Single writer.WriteMember(MemberKey.SingleMaxValue, simpleObject.SingleMaxValue); writer.WriteMember(MemberKey.WriteOnlySingleMaxValue, simpleObject.SingleMaxValue); // Int32 Array writer.WriteMember(MemberKey.Int32ArrayValue, simpleObject.Int32ArrayValue); writer.WriteMember(MemberKey.WriteOnlyInt32ArrayValue, simpleObject.Int32ArrayValue); // Empty Int32 Array writer.WriteMember(MemberKey.Int32ArrayEmptyValue, simpleObject.Int32ArrayEmptyValue); writer.WriteMember(MemberKey.WriteOnlyInt32ArrayEmptyValue, simpleObject.Int32ArrayEmptyValue); // Null Int32 Array writer.WriteMember(MemberKey.Int32ArrayNullValue, simpleObject.Int32ArrayNullValue); writer.WriteMember(MemberKey.WriteOnlyInt32ArrayNullValue, simpleObject.Int32ArrayNullValue); // String Array writer.WriteMember(MemberKey.StringArrayValue, simpleObject.StringArrayValue); writer.WriteMember(MemberKey.WriteOnlyStringArrayValue, simpleObject.StringArrayValue); // Empty String Array writer.WriteMember(MemberKey.StringArrayEmptyValue, simpleObject.StringArrayEmptyValue); writer.WriteMember(MemberKey.WriteOnlyStringArrayEmptyValue, simpleObject.StringArrayEmptyValue); // Null String Array writer.WriteMember(MemberKey.StringArrayNullValue, simpleObject.StringArrayNullValue); writer.WriteMember(MemberKey.WriteOnlyStringArrayNullValue, simpleObject.StringArrayNullValue); // String with escapes writer.WriteMember(MemberKey.StringWithEscapesValue, simpleObject.StringWithEscapesValue); writer.WriteMember(MemberKey.WriteOnlyStringWithEscapesValue, simpleObject.StringWithEscapesValue); // String with surrogate pairs writer.WriteMember(MemberKey.StringWithSurrogatePairsValue, simpleObject.StringWithSurrogatePairsValue); writer.WriteMember(MemberKey.WriteOnlyStringWithSurrogatePairsValue, simpleObject.StringWithSurrogatePairsValue); // Double writer.WriteMember(MemberKey.DoubleValue, simpleObject.DoubleValue); writer.WriteMember(MemberKey.WriteOnlyDoubleValue, simpleObject.DoubleValue); // Min double writer.WriteMember(MemberKey.DoubleMinValue, simpleObject.DoubleMinValue); writer.WriteMember(MemberKey.WriteOnlyDoubleMinValue, simpleObject.DoubleMinValue); // Max double writer.WriteMember(MemberKey.DoubleMaxValue, simpleObject.DoubleMaxValue); writer.WriteMember(MemberKey.WriteOnlyDoubleMaxValue, simpleObject.DoubleMaxValue); // Int64 writer.WriteMember(MemberKey.Int64ZeroValue, simpleObject.Int64ZeroValue); writer.WriteMember(MemberKey.WriteOnlyInt64ZeroValue, simpleObject.Int64ZeroValue); // Min Int64 writer.WriteMember(MemberKey.Int64MinValue, simpleObject.Int64MinValue); writer.WriteMember(MemberKey.WriteOnlyInt64MinValue, simpleObject.Int64MinValue); // Max Int64 writer.WriteMember(MemberKey.Int64MaxValue, simpleObject.Int64MaxValue); writer.WriteMember(MemberKey.WriteOnlyInt64MaxValue, simpleObject.Int64MaxValue); // UInt64 writer.WriteMember(MemberKey.UInt64ZeroValue, simpleObject.UInt64ZeroValue); writer.WriteMember(MemberKey.WriteOnlyUInt64ZeroValue, simpleObject.UInt64ZeroValue); // Min UInt64 writer.WriteMember(MemberKey.UInt64MinValue, simpleObject.UInt64MinValue); writer.WriteMember(MemberKey.WriteOnlyUInt64MinValue, simpleObject.UInt64MinValue); // Max UInt64 writer.WriteMember(MemberKey.UInt64MaxValue, simpleObject.UInt64MaxValue); writer.WriteMember(MemberKey.WriteOnlyUInt64MaxValue, simpleObject.UInt64MaxValue); // Boolean true writer.WriteMember(MemberKey.BooleanTrueValue, simpleObject.BooleanTrueValue); writer.WriteMember(MemberKey.WriteOnlyBooleanTrueValue, simpleObject.BooleanTrueValue); // Boolean false writer.WriteMember(MemberKey.BooleanFalseValue, simpleObject.BooleanFalseValue); writer.WriteMember(MemberKey.WriteOnlyBooleanFalseValue, simpleObject.BooleanFalseValue); // Boolean array writer.WriteMember(MemberKey.BooleanArrayValue, simpleObject.BooleanArrayValue); writer.WriteMember(MemberKey.WriteOnlyBooleanArrayValue, simpleObject.BooleanArrayValue); writer.WriteEndObject(); }
public void SetTarget(IObjectWriter targetObjectWriter, IBaseTypeMembersWriter baseMemberWriter) { objectWriter = targetObjectWriter; baseTypeMemberWriter = baseMemberWriter; }
internal RefactorManager(IMetaModel metaModel, IObjectWriter objectWriter) { _metaModel = metaModel; _objectWriter = objectWriter; }
void ICustomSerializable.Write(IObjectWriter writer) { Guard.NotNull(writer, "writer"); writer.Write(Location); writer.Write(Speeds.Count); foreach(var speed in Speeds) { writer.Write(speed.Key); writer.Write(speed.Value); } }
public FieldWriter(IDocumentWriter ownerDocument, IObjectWriter objectWriter) { this.ownerDocument = ownerDocument; this.objectWriter = objectWriter; }
public MemberWriter(IDocumentWriter ownerDocument, IObjectWriter objectWriter) { writers = new List<IValueMemberWriter>(); writers.Add(new FieldWriter(ownerDocument, objectWriter)); }
private static void WriteMember( IObjectWriter writer, int memberKey, SimpleObject[] array) { writer.WriteStartMember(memberKey); if (null == array) { writer.WriteNullValue(); } else { writer.WriteStartArray(); foreach (SimpleObject simpleObject in array) { SimpleObject.WriteTo(writer, simpleObject); } writer.WriteEndArray(); } writer.WriteEndMember(); }
private static void WriteMember( IObjectWriter writer, int memberKey, SimpleObject[][] array) { writer.WriteStartMember(memberKey); if (array == null) { writer.WriteNullValue(); } else { writer.WriteStartArray(); foreach (var nestedArray in array) { if (null == nestedArray) { writer.WriteNullValue(); } else { writer.WriteStartArray(); foreach (var value in nestedArray) { SimpleObject.WriteTo(writer, value); } writer.WriteEndArray(); } } writer.WriteEndArray(); } writer.WriteEndMember(); }
private void Initialise(IMessageReader inner, Stream output, bool ownsOutput) { Inner = inner; Output = output; OwnsOutput = ownsOutput; Writer = new DecoratedObjectWriter(output); Stopwatch = new Stopwatch(); }