diff --git a/samples/HttpSend/Program.cs b/samples/HttpSend/Program.cs index 9e672d0..91a81ec 100644 --- a/samples/HttpSend/Program.cs +++ b/samples/HttpSend/Program.cs @@ -25,7 +25,7 @@ namespace HttpSend [Option(Description = "CloudEvents 'type' (default: com.example.myevent)", LongName = "type", ShortName = "t")] private string Type { get; } = "com.example.myevent"; - [Required,Option(Description = "HTTP(S) address to send the event to", LongName = "url", ShortName = "u"),] + [Required, Option(Description = "HTTP(S) address to send the event to", LongName = "url", ShortName = "u"),] private Uri Url { get; } public static int Main(string[] args) => CommandLineApplication.Execute(args); diff --git a/src/CloudNative.CloudEvents.Avro/AvroEventFormatter.cs b/src/CloudNative.CloudEvents.Avro/AvroEventFormatter.cs index 47ded29..8360d8b 100644 --- a/src/CloudNative.CloudEvents.Avro/AvroEventFormatter.cs +++ b/src/CloudNative.CloudEvents.Avro/AvroEventFormatter.cs @@ -92,7 +92,7 @@ namespace CloudNative.CloudEvents.Avro { throw new ArgumentException($"Record has no '{AttributeName}' field"); } - IDictionary recordAttributes = (IDictionary)attrObj; + IDictionary recordAttributes = (IDictionary) attrObj; if (!recordAttributes.TryGetValue(CloudEventsSpecVersion.SpecVersionAttribute.Name, out var versionId) || !(versionId is string versionIdString)) @@ -131,7 +131,7 @@ namespace CloudNative.CloudEvents.Avro } else if (value is string) { - cloudEvent.SetAttributeFromString(key, (string)value); + cloudEvent.SetAttributeFromString(key, (string) value); } else { diff --git a/src/CloudNative.CloudEvents.NewtonsoftJson/JsonEventFormatter.cs b/src/CloudNative.CloudEvents.NewtonsoftJson/JsonEventFormatter.cs index 2d21be4..20c9150 100644 --- a/src/CloudNative.CloudEvents.NewtonsoftJson/JsonEventFormatter.cs +++ b/src/CloudNative.CloudEvents.NewtonsoftJson/JsonEventFormatter.cs @@ -211,7 +211,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson throw new ArgumentException($"Structured mode content does not represent a CloudEvent"); } var specVersion = CloudEventsSpecVersion.FromVersionId((string?) specVersionToken) - ?? throw new ArgumentException($"Unsupported CloudEvents spec version '{(string?)specVersionToken}'"); + ?? throw new ArgumentException($"Unsupported CloudEvents spec version '{(string?) specVersionToken}'"); var cloudEvent = new CloudEvent(specVersion, extensionAttributes); PopulateAttributesFromStructuredEvent(cloudEvent, jObject); @@ -247,10 +247,10 @@ namespace CloudNative.CloudEvents.NewtonsoftJson string? attributeValue = value.Type switch { - JTokenType.String => (string?)value, - JTokenType.Boolean => CloudEventAttributeType.Boolean.Format((bool)value), + JTokenType.String => (string?) value, + JTokenType.Boolean => CloudEventAttributeType.Boolean.Format((bool) value), JTokenType.Null => null, - JTokenType.Integer => CloudEventAttributeType.Integer.Format((int)value), + JTokenType.Integer => CloudEventAttributeType.Integer.Format((int) value), _ => throw new ArgumentException($"Invalid token type '{value.Type}' for CloudEvent attribute") }; if (attributeValue is null) @@ -345,7 +345,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson { throw new ArgumentException($"Structured mode property '{DataBase64PropertyName}' must be a string, when present."); } - cloudEvent.Data = Convert.FromBase64String((string?)dataBase64Token); + cloudEvent.Data = Convert.FromBase64String((string?) dataBase64Token); } /// @@ -696,7 +696,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson /// protected override void EncodeStructuredModeData(CloudEvent cloudEvent, JsonWriter writer) { - T data = (T)cloudEvent.Data; + T data = (T) cloudEvent.Data; writer.WritePropertyName(DataPropertyName); Serializer.Serialize(writer, data); } diff --git a/src/CloudNative.CloudEvents.Protobuf/ProtobufEventFormatter.cs b/src/CloudNative.CloudEvents.Protobuf/ProtobufEventFormatter.cs index 6070bbc..d208cb3 100644 --- a/src/CloudNative.CloudEvents.Protobuf/ProtobufEventFormatter.cs +++ b/src/CloudNative.CloudEvents.Protobuf/ProtobufEventFormatter.cs @@ -1,4 +1,4 @@ -// Copyright 2021 Cloud Native Foundation. +// Copyright 2021 Cloud Native Foundation. // Licensed under the Apache 2.0 license. // See LICENSE file in the project root for full license information. @@ -229,7 +229,7 @@ namespace CloudNative.CloudEvents.Protobuf // Note: impossible to cover in tests throw new ArgumentException($"Unhandled protobuf attribute case: {pair.Value.AttrCase}", paramName); } - + // If we've already got an extension attribute specified for this name, // we validate against it and require the value in the proto to have the right // type. Otherwise, we create a new extension attribute of the correct type. @@ -254,7 +254,7 @@ namespace CloudNative.CloudEvents.Protobuf throw new ArgumentException( $"Attribute '{attr.Name}' was specified with type '{attr.Type}', but has type '{attrTypeFromProto}' in the protobuf representation."); } - + // Note: the indexer performs validation. cloudEvent[attr] = pair.Value.AttrCase switch { diff --git a/src/CloudNative.CloudEvents.SystemTextJson/JsonEventFormatter.cs b/src/CloudNative.CloudEvents.SystemTextJson/JsonEventFormatter.cs index 2cde1df..f667ee6 100644 --- a/src/CloudNative.CloudEvents.SystemTextJson/JsonEventFormatter.cs +++ b/src/CloudNative.CloudEvents.SystemTextJson/JsonEventFormatter.cs @@ -331,7 +331,7 @@ namespace CloudNative.CloudEvents.SystemTextJson { // If no content type has been specified, default to application/json cloudEvent.DataContentType ??= JsonMediaType; - + DecodeStructuredModeDataProperty(dataElement, cloudEvent); } } @@ -677,7 +677,7 @@ namespace CloudNative.CloudEvents.SystemTextJson { return Array.Empty(); } - T data = (T)cloudEvent.Data; + T data = (T) cloudEvent.Data; return JsonSerializer.SerializeToUtf8Bytes(data, SerializerOptions); } @@ -697,7 +697,7 @@ namespace CloudNative.CloudEvents.SystemTextJson /// protected override void EncodeStructuredModeData(CloudEvent cloudEvent, Utf8JsonWriter writer) { - T data = (T)cloudEvent.Data; + T data = (T) cloudEvent.Data; writer.WritePropertyName(DataPropertyName); JsonSerializer.Serialize(writer, data, SerializerOptions); } diff --git a/src/CloudNative.CloudEvents/CloudEvent.cs b/src/CloudNative.CloudEvents/CloudEvent.cs index f9ef381..776c0ea 100644 --- a/src/CloudNative.CloudEvents/CloudEvent.cs +++ b/src/CloudNative.CloudEvents/CloudEvent.cs @@ -183,7 +183,7 @@ namespace CloudNative.CloudEvents Validation.CheckNotNull(attributeName, nameof(attributeName)); Validation.CheckArgument(attributeName != CloudEventsSpecVersion.SpecVersionAttributeName, nameof(attributeName), () => Strings.ErrorCannotIndexBySpecVersionAttribute); return attributeValues.GetValueOrDefault(Validation.CheckNotNull(attributeName, nameof(attributeName))); - } + } set { Validation.CheckNotNull(attributeName, nameof(attributeName)); @@ -229,7 +229,7 @@ namespace CloudNative.CloudEvents public string? DataContentType { // TODO: Guard against a version that doesn't have this attribute? - get => (string?)this[SpecVersion.DataContentTypeAttribute]; + get => (string?) this[SpecVersion.DataContentTypeAttribute]; set => this[SpecVersion.DataContentTypeAttribute] = value; } @@ -239,7 +239,7 @@ namespace CloudNative.CloudEvents /// public string? Id { - get => (string?)this[SpecVersion.IdAttribute]; + get => (string?) this[SpecVersion.IdAttribute]; set => this[SpecVersion.IdAttribute] = value; } @@ -250,7 +250,7 @@ namespace CloudNative.CloudEvents /// public Uri? DataSchema { - get => (Uri?)this[SpecVersion.DataSchemaAttribute]; + get => (Uri?) this[SpecVersion.DataSchemaAttribute]; set => this[SpecVersion.DataSchemaAttribute] = value; } @@ -262,7 +262,7 @@ namespace CloudNative.CloudEvents /// public Uri? Source { - get => (Uri?)this[SpecVersion.SourceAttribute]; + get => (Uri?) this[SpecVersion.SourceAttribute]; set => this[SpecVersion.SourceAttribute] = value; } @@ -280,7 +280,7 @@ namespace CloudNative.CloudEvents /// public string? Subject { - get => (string?)this[SpecVersion.SubjectAttribute]; + get => (string?) this[SpecVersion.SubjectAttribute]; set => this[SpecVersion.SubjectAttribute] = value; } @@ -290,7 +290,7 @@ namespace CloudNative.CloudEvents /// public DateTimeOffset? Time { - get => (DateTimeOffset?)this[SpecVersion.TimeAttribute]; + get => (DateTimeOffset?) this[SpecVersion.TimeAttribute]; set => this[SpecVersion.TimeAttribute] = value; } @@ -301,7 +301,7 @@ namespace CloudNative.CloudEvents /// public string? Type { - get => (string?)this[SpecVersion.TypeAttribute]; + get => (string?) this[SpecVersion.TypeAttribute]; set => this[SpecVersion.TypeAttribute] = value; } diff --git a/src/CloudNative.CloudEvents/CloudEventAttributeType.cs b/src/CloudNative.CloudEvents/CloudEventAttributeType.cs index d60a216..ebe9bd7 100644 --- a/src/CloudNative.CloudEvents/CloudEventAttributeType.cs +++ b/src/CloudNative.CloudEvents/CloudEventAttributeType.cs @@ -122,7 +122,7 @@ namespace CloudNative.CloudEvents throw new ArgumentException($"Value of type {value.GetType()} is incompatible with expected type {ClrType}", nameof(value)); } - ValidateImpl((T)Validation.CheckNotNull(value, nameof(value))); + ValidateImpl((T) Validation.CheckNotNull(value, nameof(value))); } protected abstract T ParseImpl(string value); @@ -168,12 +168,12 @@ namespace CloudNative.CloudEvents // Directly from the spec if (c <= 0x1f || (c >= 0x7f && c <= 0x9f)) { - throw new ArgumentException($"Control character U+{(ushort)c:x4} is not permitted in string attributes"); + throw new ArgumentException($"Control character U+{(ushort) c:x4} is not permitted in string attributes"); } // First two ranges in http://www.unicode.org/faq/private_use.html#noncharacters if (c >= 0xfffe || (c >= 0xfdd0 && c <= 0xfdef)) { - throw new ArgumentException($"Noncharacter U+{(ushort)c:x4} is not permitted in string attributes"); + throw new ArgumentException($"Noncharacter U+{(ushort) c:x4} is not permitted in string attributes"); } // Handle surrogate pairs, based on this character and whether the last character was a high surrogate. @@ -185,7 +185,7 @@ namespace CloudNative.CloudEvents { if (lastCharWasHighSurrogate) { - throw new ArgumentException($"High surrogate character U+{(ushort)value[i - 1]:x4} must be followed by a low surrogate character"); + throw new ArgumentException($"High surrogate character U+{(ushort) value[i - 1]:x4} must be followed by a low surrogate character"); } lastCharWasHighSurrogate = true; } @@ -193,7 +193,7 @@ namespace CloudNative.CloudEvents { if (!lastCharWasHighSurrogate) { - throw new ArgumentException($"Low surrogate character U+{(ushort)c:x4} must be preceded by a high surrogate character"); + throw new ArgumentException($"Low surrogate character U+{(ushort) c:x4} must be preceded by a high surrogate character"); } // Convert the surrogate pair to validate it's not a non-character. // This is the third rule in http://www.unicode.org/faq/private_use.html#noncharacters @@ -208,12 +208,12 @@ namespace CloudNative.CloudEvents } else if (lastCharWasHighSurrogate) { - throw new ArgumentException($"High surrogate character U+{(ushort)value[i - 1]:x4} must be followed by a low surrogate character"); + throw new ArgumentException($"High surrogate character U+{(ushort) value[i - 1]:x4} must be followed by a low surrogate character"); } } if (lastCharWasHighSurrogate) { - throw new ArgumentException($"String must not end with high surrogate character U+{(ushort)value[value.Length - 1]:x4}"); + throw new ArgumentException($"String must not end with high surrogate character U+{(ushort) value[value.Length - 1]:x4}"); } } } diff --git a/src/CloudNative.CloudEvents/CloudEventFormatter.cs b/src/CloudNative.CloudEvents/CloudEventFormatter.cs index 0cb3e96..aee5375 100644 --- a/src/CloudNative.CloudEvents/CloudEventFormatter.cs +++ b/src/CloudNative.CloudEvents/CloudEventFormatter.cs @@ -185,7 +185,7 @@ namespace CloudNative.CloudEvents /// The CloudEvent to get or infer the data content type from. Must not be null. /// The data content type of the CloudEvent, or null for no data content type. public virtual string? GetOrInferDataContentType(CloudEvent cloudEvent) - { + { Validation.CheckNotNull(cloudEvent, nameof(cloudEvent)); return cloudEvent.DataContentType is string dataContentType ? dataContentType : cloudEvent.Data is not object data ? null diff --git a/src/CloudNative.CloudEvents/CloudEventFormatterAttribute.cs b/src/CloudNative.CloudEvents/CloudEventFormatterAttribute.cs index 74f30d7..689abd8 100644 --- a/src/CloudNative.CloudEvents/CloudEventFormatterAttribute.cs +++ b/src/CloudNative.CloudEvents/CloudEventFormatterAttribute.cs @@ -1,4 +1,4 @@ -// Copyright 2021 Cloud Native Foundation. +// Copyright 2021 Cloud Native Foundation. // Licensed under the Apache 2.0 license. // See LICENSE file in the project root for full license information. @@ -73,6 +73,6 @@ namespace CloudNative.CloudEvents } return formatter; + } } - } -} \ No newline at end of file +} diff --git a/src/CloudNative.CloudEvents/CloudEventsSpecVersion.cs b/src/CloudNative.CloudEvents/CloudEventsSpecVersion.cs index bd4534b..8a9081c 100644 --- a/src/CloudNative.CloudEvents/CloudEventsSpecVersion.cs +++ b/src/CloudNative.CloudEvents/CloudEventsSpecVersion.cs @@ -98,7 +98,7 @@ namespace CloudNative.CloudEvents /// or null if no such version is known. /// /// The version ID to check. May be null, in which case the result will be null. - [return:NotNullIfNotNull(nameof(VersionId))] + [return: NotNullIfNotNull(nameof(VersionId))] public static CloudEventsSpecVersion? FromVersionId(string? versionId) => allVersions.FirstOrDefault(version => version.VersionId == versionId); @@ -159,7 +159,7 @@ namespace CloudNative.CloudEvents private static void NonEmptyString(object value) { - string text = (string)value; + string text = (string) value; if (text.Length == 0) { throw new ArgumentException("Value must be non-empty"); @@ -179,7 +179,7 @@ namespace CloudNative.CloudEvents { try { - _ = new ContentType((string)value); + _ = new ContentType((string) value); } catch { diff --git a/src/CloudNative.CloudEvents/Core/BinaryDataUtilities.cs b/src/CloudNative.CloudEvents/Core/BinaryDataUtilities.cs index 3f951f0..c77acf9 100644 --- a/src/CloudNative.CloudEvents/Core/BinaryDataUtilities.cs +++ b/src/CloudNative.CloudEvents/Core/BinaryDataUtilities.cs @@ -51,7 +51,7 @@ namespace CloudNative.CloudEvents.Core // It's safe to use memory.GetBuffer() and memory.Position here, as this is a stream // we've created using the parameterless constructor. var buffer = memory.GetBuffer(); - return new ReadOnlyMemory(buffer, 0, (int)memory.Position); + return new ReadOnlyMemory(buffer, 0, (int) memory.Position); } /// diff --git a/src/CloudNative.CloudEvents/Extensions/Sampling.cs b/src/CloudNative.CloudEvents/Extensions/Sampling.cs index 15e2851..eda0a99 100644 --- a/src/CloudNative.CloudEvents/Extensions/Sampling.cs +++ b/src/CloudNative.CloudEvents/Extensions/Sampling.cs @@ -51,7 +51,7 @@ namespace CloudNative.CloudEvents.Extensions private static void PositiveInteger(object value) { - if ((int)value <= 0) + if ((int) value <= 0) { throw new ArgumentOutOfRangeException("Sampled rate must be positive."); } diff --git a/src/CloudNative.CloudEvents/Extensions/Sequence.cs b/src/CloudNative.CloudEvents/Extensions/Sequence.cs index 585b256..1eb563b 100644 --- a/src/CloudNative.CloudEvents/Extensions/Sequence.cs +++ b/src/CloudNative.CloudEvents/Extensions/Sequence.cs @@ -86,7 +86,7 @@ namespace CloudNative.CloudEvents.Extensions /// The CloudEvent from which to retrieve the attribute. Must not be null. /// The value, as a string, or null if the attribute is not set. public static string? GetSequenceType(this CloudEvent cloudEvent) => - (string?)Validation.CheckNotNull(cloudEvent, nameof(cloudEvent))[SequenceTypeAttribute]; + (string?) Validation.CheckNotNull(cloudEvent, nameof(cloudEvent))[SequenceTypeAttribute]; /// /// Retrieves the value from the event, @@ -107,7 +107,7 @@ namespace CloudNative.CloudEvents.Extensions return null; } var type = GetSequenceType(cloudEvent); - if (type == null) + if (type == null) { return sequence; } diff --git a/src/CloudNative.CloudEvents/Http/HttpClientExtensions.cs b/src/CloudNative.CloudEvents/Http/HttpClientExtensions.cs index c1965d7..b439ffc 100644 --- a/src/CloudNative.CloudEvents/Http/HttpClientExtensions.cs +++ b/src/CloudNative.CloudEvents/Http/HttpClientExtensions.cs @@ -60,7 +60,7 @@ namespace CloudNative.CloudEvents.Http Validation.CheckNotNull(httpRequestMessage, nameof(httpRequestMessage)); return HasCloudEventsBatchContentType(httpRequestMessage.Content); } - + /// /// Indicates whether this holds a batch of CloudEvents. /// diff --git a/src/CloudNative.CloudEvents/Http/HttpListenerExtensions.cs b/src/CloudNative.CloudEvents/Http/HttpListenerExtensions.cs index 7e83936..29ee181 100644 --- a/src/CloudNative.CloudEvents/Http/HttpListenerExtensions.cs +++ b/src/CloudNative.CloudEvents/Http/HttpListenerExtensions.cs @@ -223,7 +223,7 @@ namespace CloudNative.CloudEvents.Http this HttpListenerRequest httpListenerRequest, CloudEventFormatter formatter, params CloudEventAttribute[]? extensionAttributes) => - ToCloudEventBatchAsync(httpListenerRequest, formatter, (IEnumerable?)extensionAttributes); + ToCloudEventBatchAsync(httpListenerRequest, formatter, (IEnumerable?) extensionAttributes); /// /// Converts this HTTP request message into a CloudEvent batch. @@ -263,7 +263,7 @@ namespace CloudNative.CloudEvents.Http CloudEventFormatter formatter, IEnumerable? extensionAttributes) => ToCloudEventBatchInternalAsync(httpListenerRequest, formatter, extensionAttributes, async: false).GetAwaiter().GetResult(); - + private async static Task> ToCloudEventBatchInternalAsync(HttpListenerRequest httpListenerRequest, CloudEventFormatter formatter, IEnumerable? extensionAttributes, bool async) { diff --git a/src/CloudNative.CloudEvents/Timestamps.cs b/src/CloudNative.CloudEvents/Timestamps.cs index 6b112fd..2d6ed7c 100644 --- a/src/CloudNative.CloudEvents/Timestamps.cs +++ b/src/CloudNative.CloudEvents/Timestamps.cs @@ -51,7 +51,7 @@ namespace CloudNative.CloudEvents { // TODO: Check this and add a test Validation.CheckNotNull(input, nameof(input)); - + if (input.Length < MinLength) // "yyyy-MM-ddTHH:mm:ssZ" is the shortest possible value. { result = default; diff --git a/test/CloudNative.CloudEvents.UnitTests/Amqp/AmqpTest.cs b/test/CloudNative.CloudEvents.UnitTests/Amqp/AmqpTest.cs index c944b2f..3d15ffc 100644 --- a/test/CloudNative.CloudEvents.UnitTests/Amqp/AmqpTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/Amqp/AmqpTest.cs @@ -30,7 +30,7 @@ namespace CloudNative.CloudEvents.Amqp.UnitTests { // The AMQPNetLite library is factored such that we don't need to do a wire test here. var cloudEvent = CreateSampleCloudEvent(); - var message = cloudEvent.ToAmqpMessage(ContentMode.Binary, new JsonEventFormatter()); + var message = cloudEvent.ToAmqpMessage(ContentMode.Binary, new JsonEventFormatter()); Assert.True(message.IsCloudEvent()); var encodedAmqpMessage = message.Encode(); diff --git a/test/CloudNative.CloudEvents.UnitTests/AspNetCore/HttpResponseExtensionsTest.cs b/test/CloudNative.CloudEvents.UnitTests/AspNetCore/HttpResponseExtensionsTest.cs index 38d5d24..691f4b1 100644 --- a/test/CloudNative.CloudEvents.UnitTests/AspNetCore/HttpResponseExtensionsTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/AspNetCore/HttpResponseExtensionsTest.cs @@ -29,7 +29,7 @@ namespace CloudNative.CloudEvents.AspNetCore.UnitTests var formatter = new JsonEventFormatter(); var response = CreateResponse(); await cloudEvent.CopyToHttpResponseAsync(response, ContentMode.Binary, formatter); - + var content = GetContent(response); Assert.Equal("text/plain", response.ContentType); Assert.Equal("plain text", Encoding.UTF8.GetString(content.Span)); @@ -76,7 +76,7 @@ namespace CloudNative.CloudEvents.AspNetCore.UnitTests var cloudEvent = new CloudEvent().PopulateRequiredAttributes(); var formatter = new JsonEventFormatter(); var response = CreateResponse(); - await Assert.ThrowsAsync(() => cloudEvent.CopyToHttpResponseAsync(response, (ContentMode)100, formatter)); + await Assert.ThrowsAsync(() => cloudEvent.CopyToHttpResponseAsync(response, (ContentMode) 100, formatter)); } [Fact] @@ -117,7 +117,7 @@ namespace CloudNative.CloudEvents.AspNetCore.UnitTests var parsedBatch = new JsonEventFormatter().DecodeBatchModeMessage(content, new ContentType(response.ContentType), extensionAttributes: null); AssertBatchesEqual(batch, parsedBatch); } - + private static HttpResponse CreateResponse() => new DefaultHttpResponse(new DefaultHttpContext()) { Body = new MemoryStream() }; private static ReadOnlyMemory GetContent(HttpResponse response) { diff --git a/test/CloudNative.CloudEvents.UnitTests/Avro/AvroEventFormatterTest.cs b/test/CloudNative.CloudEvents.UnitTests/Avro/AvroEventFormatterTest.cs index 037cc0b..043b2c9 100644 --- a/test/CloudNative.CloudEvents.UnitTests/Avro/AvroEventFormatterTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/Avro/AvroEventFormatterTest.cs @@ -61,9 +61,9 @@ namespace CloudNative.CloudEvents.Avro.UnitTests Assert.Equal(MediaTypeNames.Text.Xml, cloudEvent.DataContentType); Assert.Equal("", cloudEvent.Data); - Assert.Equal("value", (string?)cloudEvent["comexampleextension1"]); + Assert.Equal("value", (string?) cloudEvent["comexampleextension1"]); } - + [Fact] public void StructuredParseWithExtensionsSuccess() { diff --git a/test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTest.cs b/test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTest.cs index cedb9e0..0879a5a 100644 --- a/test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTest.cs @@ -59,7 +59,7 @@ namespace CloudNative.CloudEvents.UnitTests { var attr = CloudEventsSpecVersion.V1_0.TimeAttribute; Assert.Equal("time", attr.Name); - Assert.Equal("time", attr.ToString()); + Assert.Equal("time", attr.ToString()); Assert.Equal(CloudEventAttributeType.Timestamp, attr.Type); Assert.False(attr.IsRequired); Assert.False(attr.IsExtension); @@ -152,7 +152,7 @@ namespace CloudNative.CloudEvents.UnitTests private void ValidateNonNegative(object value) { - if ((int)value < 0) + if ((int) value < 0) { throw new Exception("Custom validation message"); } diff --git a/test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTypeTest.cs b/test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTypeTest.cs index 7958136..9856a29 100644 --- a/test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTypeTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTypeTest.cs @@ -74,9 +74,9 @@ namespace CloudNative.CloudEvents.UnitTests [Theory] [InlineData("")] // Examples from https://en.wikipedia.org/wiki/Base64 - [InlineData("TWFu", (byte) 77, (byte)97, (byte) 110)] - [InlineData("TWE=", (byte)77, (byte)97)] - [InlineData("TQ==", (byte)77)] + [InlineData("TWFu", (byte) 77, (byte) 97, (byte) 110)] + [InlineData("TWE=", (byte) 77, (byte) 97)] + [InlineData("TQ==", (byte) 77)] public void ParseAndFormat_Valid(string text, params byte[] bytes) { var parsedBytes = CloudEventAttributeType.Binary.Parse(text); @@ -199,7 +199,7 @@ namespace CloudNative.CloudEvents.UnitTests [InlineData(0x20, 0xd800)] // High surrogate at end of string public void InvalidSurrogates(int first, int second) { - string text = $"{(char)first}{(char)second}"; + string text = $"{(char) first}{(char) second}"; Assert.Throws(() => CloudEventAttributeType.String.Validate(text)); } } diff --git a/test/CloudNative.CloudEvents.UnitTests/CloudEventTest.cs b/test/CloudNative.CloudEvents.UnitTests/CloudEventTest.cs index 764d7db..c28ec34 100644 --- a/test/CloudNative.CloudEvents.UnitTests/CloudEventTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/CloudEventTest.cs @@ -37,7 +37,7 @@ namespace CloudNative.CloudEvents.UnitTests Assert.Equal(MediaTypeNames.Text.Xml, cloudEvent.DataContentType); Assert.Equal("", cloudEvent.Data); - Assert.Equal("value", (string?)cloudEvent["comexampleextension1"]); + Assert.Equal("value", (string?) cloudEvent["comexampleextension1"]); } [Fact] @@ -47,7 +47,7 @@ namespace CloudNative.CloudEvents.UnitTests var cloudEvent = new CloudEvent(new[] { extension }) { - Type = "com.github.pull.create", + Type = "com.github.pull.create", Id = "A234-1234-1234", Time = sampleTimestamp, [extension] = 10 @@ -263,10 +263,10 @@ namespace CloudNative.CloudEvents.UnitTests public void Indexer_NullKey_Throws() { var cloudEvent = new CloudEvent(); - Assert.Throws(() => cloudEvent[(string)null!]); - Assert.Throws(() => cloudEvent[(CloudEventAttribute)null!]); - Assert.Throws(() => cloudEvent[(string)null!] = "text"); - Assert.Throws(() => cloudEvent[(CloudEventAttribute)null!] = "text"); + Assert.Throws(() => cloudEvent[(string) null!]); + Assert.Throws(() => cloudEvent[(CloudEventAttribute) null!]); + Assert.Throws(() => cloudEvent[(string) null!] = "text"); + Assert.Throws(() => cloudEvent[(CloudEventAttribute) null!] = "text"); } [Fact] diff --git a/test/CloudNative.CloudEvents.UnitTests/Http/HttpClientExtensionsTest.cs b/test/CloudNative.CloudEvents.UnitTests/Http/HttpClientExtensionsTest.cs index 8b50729..d711a80 100644 --- a/test/CloudNative.CloudEvents.UnitTests/Http/HttpClientExtensionsTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/Http/HttpClientExtensionsTest.cs @@ -216,7 +216,7 @@ namespace CloudNative.CloudEvents.Http.UnitTests }; await cloudEvent.CopyToHttpListenerResponseAsync(context.Response, ContentMode.Binary, new JsonEventFormatter()); - context.Response.StatusCode = (int)HttpStatusCode.OK; + context.Response.StatusCode = (int) HttpStatusCode.OK; }); var httpClient = new HttpClient(); @@ -283,7 +283,7 @@ namespace CloudNative.CloudEvents.Http.UnitTests Assert.Equal("value", receivedCloudEvent["comexampleextension1"]); // The non-ASCII attribute value should have been correctly URL-decoded. Assert.Equal("æøå", receivedCloudEvent["utf8examplevalue"]); - context.Response.StatusCode = (int)HttpStatusCode.NoContent; + context.Response.StatusCode = (int) HttpStatusCode.NoContent; return Task.CompletedTask; }); @@ -314,7 +314,7 @@ namespace CloudNative.CloudEvents.Http.UnitTests }; await cloudEvent.CopyToHttpListenerResponseAsync(context.Response, ContentMode.Structured, new JsonEventFormatter()); - context.Response.StatusCode = (int)HttpStatusCode.OK; + context.Response.StatusCode = (int) HttpStatusCode.OK; }); var httpClient = new HttpClient(); @@ -384,7 +384,7 @@ namespace CloudNative.CloudEvents.Http.UnitTests Assert.Equal("value", receivedCloudEvent["comexampleextension1"]); Assert.Equal("æøå", receivedCloudEvent["utf8examplevalue"]); - context.Response.StatusCode = (int)HttpStatusCode.NoContent; + context.Response.StatusCode = (int) HttpStatusCode.NoContent; return Task.CompletedTask; }); diff --git a/test/CloudNative.CloudEvents.UnitTests/Http/HttpListenerExtensionsTest.cs b/test/CloudNative.CloudEvents.UnitTests/Http/HttpListenerExtensionsTest.cs index 812b629..960c049 100644 --- a/test/CloudNative.CloudEvents.UnitTests/Http/HttpListenerExtensionsTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/Http/HttpListenerExtensionsTest.cs @@ -305,7 +305,7 @@ namespace CloudNative.CloudEvents.Http.UnitTests { executed = true; result = await handler(context); - context.Response.StatusCode = (int)HttpStatusCode.NoContent; + context.Response.StatusCode = (int) HttpStatusCode.NoContent; }; var httpClient = new HttpClient(); diff --git a/test/CloudNative.CloudEvents.UnitTests/Http/HttpTestBase.cs b/test/CloudNative.CloudEvents.UnitTests/Http/HttpTestBase.cs index 0726928..f6dc20c 100644 --- a/test/CloudNative.CloudEvents.UnitTests/Http/HttpTestBase.cs +++ b/test/CloudNative.CloudEvents.UnitTests/Http/HttpTestBase.cs @@ -103,7 +103,7 @@ namespace CloudNative.CloudEvents.Http.UnitTests try { listener.Start(); - return ((IPEndPoint)listener.LocalEndpoint).Port; + return ((IPEndPoint) listener.LocalEndpoint).Port; } finally { diff --git a/test/CloudNative.CloudEvents.UnitTests/Http/HttpWebExtensionsTest.cs b/test/CloudNative.CloudEvents.UnitTests/Http/HttpWebExtensionsTest.cs index b279c94..57f96cf 100644 --- a/test/CloudNative.CloudEvents.UnitTests/Http/HttpWebExtensionsTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/Http/HttpWebExtensionsTest.cs @@ -56,11 +56,11 @@ namespace CloudNative.CloudEvents.Http.UnitTests Assert.Equal("value", receivedCloudEvent["comexampleextension1"]); Assert.Equal("æøå", receivedCloudEvent["utf8examplevalue"]); - context.Response.StatusCode = (int)HttpStatusCode.NoContent; + context.Response.StatusCode = (int) HttpStatusCode.NoContent; return Task.CompletedTask; }); - var result = (HttpWebResponse)await httpWebRequest.GetResponseAsync(); + var result = (HttpWebResponse) await httpWebRequest.GetResponseAsync(); var content = new StreamReader(result.GetResponseStream()).ReadToEnd(); Assert.True(result.StatusCode == HttpStatusCode.NoContent, content); } @@ -100,7 +100,7 @@ namespace CloudNative.CloudEvents.Http.UnitTests Assert.Equal("value", receivedCloudEvent["comexampleextension1"]); Assert.Equal("æøå", receivedCloudEvent["utf8examplevalue"]); - context.Response.StatusCode = (int)HttpStatusCode.NoContent; + context.Response.StatusCode = (int) HttpStatusCode.NoContent; return Task.CompletedTask; }); diff --git a/test/CloudNative.CloudEvents.UnitTests/Kafka/KafkaTest.cs b/test/CloudNative.CloudEvents.UnitTests/Kafka/KafkaTest.cs index 77c8f3d..7d1b258 100644 --- a/test/CloudNative.CloudEvents.UnitTests/Kafka/KafkaTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/Kafka/KafkaTest.cs @@ -57,7 +57,7 @@ namespace CloudNative.CloudEvents.Kafka.UnitTests Data = "", ["comexampleextension1"] = "value" }; - + var message = cloudEvent.ToKafkaMessage(ContentMode.Structured, new JsonEventFormatter()); Assert.True(message.IsCloudEvent()); @@ -79,7 +79,7 @@ namespace CloudNative.CloudEvents.Kafka.UnitTests Assert.Equal(MediaTypeNames.Text.Xml, receivedCloudEvent.DataContentType); Assert.Equal("", receivedCloudEvent.Data); - Assert.Equal("value", (string?)receivedCloudEvent["comexampleextension1"]); + Assert.Equal("value", (string?) receivedCloudEvent["comexampleextension1"]); } [Fact] @@ -126,7 +126,7 @@ namespace CloudNative.CloudEvents.Kafka.UnitTests Assert.Equal("", receivedCloudEvent.Data); Assert.Equal("hello much wow", (string?) receivedCloudEvent[Partitioning.PartitionKeyAttribute]); - Assert.Equal("value", (string?)receivedCloudEvent["comexampleextension1"]); + Assert.Equal("value", (string?) receivedCloudEvent["comexampleextension1"]); } [Theory] @@ -176,8 +176,8 @@ namespace CloudNative.CloudEvents.Kafka.UnitTests AssertTimestampsEqual("2018-04-05T17:31:00Z", receivedCloudEvent.Time!.Value); Assert.Equal(contentType, receivedCloudEvent.DataContentType); Assert.Equal(expectedDecodedResult, receivedCloudEvent.Data); - Assert.Equal("hello much wow", (string?)receivedCloudEvent[Partitioning.PartitionKeyAttribute]); - Assert.Equal("value", (string?)receivedCloudEvent["comexampleextension1"]); + Assert.Equal("hello much wow", (string?) receivedCloudEvent[Partitioning.PartitionKeyAttribute]); + Assert.Equal("value", (string?) receivedCloudEvent["comexampleextension1"]); } [Fact] @@ -207,12 +207,12 @@ namespace CloudNative.CloudEvents.Kafka.UnitTests { return null; } - else + else { var surrogate = serializer.Deserialize>(reader)!; var headers = new Headers(); - foreach(var header in surrogate) + foreach (var header in surrogate) { headers.Add(header.Key, header.GetValueBytes()); } @@ -247,7 +247,7 @@ namespace CloudNative.CloudEvents.Kafka.UnitTests public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { - var header = (IHeader)value!; + var header = (IHeader) value!; var container = new HeaderContainer { Key = header.Key, Value = header.GetValueBytes() }; serializer.Serialize(writer, container); } diff --git a/test/CloudNative.CloudEvents.UnitTests/Mqtt/MqttTest.cs b/test/CloudNative.CloudEvents.UnitTests/Mqtt/MqttTest.cs index d99877c..d9dd3af 100644 --- a/test/CloudNative.CloudEvents.UnitTests/Mqtt/MqttTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/Mqtt/MqttTest.cs @@ -76,7 +76,7 @@ namespace CloudNative.CloudEvents.Mqtt.UnitTests Assert.Equal(MediaTypeNames.Text.Xml, receivedCloudEvent.DataContentType); Assert.Equal("", receivedCloudEvent.Data); - Assert.Equal("value", (string?)receivedCloudEvent["comexampleextension1"]); + Assert.Equal("value", (string?) receivedCloudEvent["comexampleextension1"]); } } } \ No newline at end of file diff --git a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/ConformanceTest.cs b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/ConformanceTest.cs index 4c251f4..e7acb1f 100644 --- a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/ConformanceTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/ConformanceTest.cs @@ -56,7 +56,7 @@ public class ConformanceTest // We don't have a convenience method for batches, so serialize the array back to JSON. var json = test.Batch.ToString(); var body = Encoding.UTF8.GetBytes(json); - IReadOnlyList actual = new JsonEventFormatter().DecodeBatchModeMessage(body, contentType: null, extensions); + IReadOnlyList actual = new JsonEventFormatter().DecodeBatchModeMessage(body, contentType: null, extensions); TestHelpers.AssertBatchesEqual(expected, actual, TestHelpers.InstantOnlyTimestampComparer); } diff --git a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/ConformanceTestFile.cs b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/ConformanceTestFile.cs index 3f58315..23ac2f9 100644 --- a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/ConformanceTestFile.cs +++ b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/ConformanceTestFile.cs @@ -26,7 +26,7 @@ public class ConformanceTestFile test.TestType ??= testFile.TestType; } return testFile; - } + } } public class JsonConformanceTest @@ -43,7 +43,7 @@ public class JsonConformanceTest } public enum ConformanceTestType -{ +{ ValidSingleEvent, ValidBatch, InvalidSingleEvent, diff --git a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/GenericJsonEventFormatterTest.cs b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/GenericJsonEventFormatterTest.cs index 80633d4..7ab374f 100644 --- a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/GenericJsonEventFormatterTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/GenericJsonEventFormatterTest.cs @@ -26,7 +26,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson.UnitTests var formatter = CreateFormatter(); var cloudEvent = formatter.DecodeStructuredModeMessage(bytes, null, null); - var model = (AttributedModel)cloudEvent.Data!; + var model = (AttributedModel) cloudEvent.Data!; Assert.Equal("test", model.AttributedProperty); } @@ -40,7 +40,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson.UnitTests var formatter = CreateFormatter(); var cloudEvent = formatter.DecodeStructuredModeMessage(bytes, new ContentType("text/plain"), null); - var model = (AttributedModel)cloudEvent.Data!; + var model = (AttributedModel) cloudEvent.Data!; Assert.Equal("test", model.AttributedProperty); } @@ -76,7 +76,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson.UnitTests var cloudEvent = new CloudEvent(); formatter.DecodeBinaryModeEventData(bytes, cloudEvent); - var model = (AttributedModel)cloudEvent.Data!; + var model = (AttributedModel) cloudEvent.Data!; Assert.Equal("test", model.AttributedProperty); } @@ -98,7 +98,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson.UnitTests var body = formatter.EncodeStructuredModeMessage(cloudEvent, out _); var jobject = JsonEventFormatterTest.ParseJson(body); Assert.False(jobject.ContainsKey("data_base64")); - var data = (JObject)jobject["data"]!; + var data = (JObject) jobject["data"]!; new JTokenAsserter { diff --git a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/JsonEventFormatterTest.cs b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/JsonEventFormatterTest.cs index 3057059..f0abb62 100644 --- a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/JsonEventFormatterTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/JsonEventFormatterTest.cs @@ -1176,7 +1176,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson.UnitTests string text = BinaryDataUtilities.GetString(data, Encoding.UTF8); var serializer = new JsonSerializer { - DateParseHandling = DateParseHandling.None + DateParseHandling = DateParseHandling.None }; return serializer.Deserialize(new JsonTextReader(new StringReader(text)))!; } diff --git a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/SpecializedFormatterTest.cs b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/SpecializedFormatterTest.cs index cb52ad4..e4ec182 100644 --- a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/SpecializedFormatterTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/SpecializedFormatterTest.cs @@ -1,4 +1,4 @@ -// Copyright 2021 Cloud Native Foundation. +// Copyright 2021 Cloud Native Foundation. // Licensed under the Apache 2.0 license. // See LICENSE file in the project root for full license information. @@ -158,7 +158,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson.UnitTests { if (cloudEvent.DataContentType == TextBinaryContentType && dataBase64Token.Type == JTokenType.String) { - cloudEvent.Data = Encoding.UTF8.GetString(Convert.FromBase64String((string)dataBase64Token!)); + cloudEvent.Data = Encoding.UTF8.GetString(Convert.FromBase64String((string) dataBase64Token!)); } else { @@ -170,7 +170,7 @@ namespace CloudNative.CloudEvents.NewtonsoftJson.UnitTests { if (cloudEvent.DataContentType == GuidContentType && dataToken.Type == JTokenType.String) { - string text = (string)dataToken!; + string text = (string) dataToken!; if (!text.StartsWith(GuidPrefix)) { throw new ArgumentException("Invalid GUID text data"); diff --git a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/SpecializedJsonReaderTest.cs b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/SpecializedJsonReaderTest.cs index 2b3a883..cdfb972 100644 --- a/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/SpecializedJsonReaderTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/NewtonsoftJson/SpecializedJsonReaderTest.cs @@ -33,8 +33,8 @@ namespace CloudNative.CloudEvents.NewtonsoftJson.UnitTests var event1 = formatter.DecodeStructuredModeMessage(CreateJsonStream(), null, null); var event2 = formatter.DecodeStructuredModeMessage(CreateJsonStream(), null, null); - JObject data1 = (JObject)event1.Data!; - JObject data2 = (JObject)event2.Data!; + JObject data1 = (JObject) event1.Data!; + JObject data2 = (JObject) event2.Data!; var property1 = data1.Properties().Single(); var property2 = data2.Properties().Single(); @@ -49,8 +49,8 @@ namespace CloudNative.CloudEvents.NewtonsoftJson.UnitTests var event1 = formatter.DecodeStructuredModeMessage(CreateJsonStream(), null, null); var event2 = formatter.DecodeStructuredModeMessage(CreateJsonStream(), null, null); - JObject data1 = (JObject)event1.Data!; - JObject data2 = (JObject)event2.Data!; + JObject data1 = (JObject) event1.Data!; + JObject data2 = (JObject) event2.Data!; var property1 = data1.Properties().Single(); var property2 = data2.Properties().Single(); diff --git a/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/ConformanceTestFile.cs b/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/ConformanceTestFile.cs index 9964181..a4244f9 100644 --- a/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/ConformanceTestFile.cs +++ b/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/ConformanceTestFile.cs @@ -56,7 +56,7 @@ public class JsonConformanceTest } public enum ConformanceTestType -{ +{ ValidSingleEvent, ValidBatch, InvalidSingleEvent, diff --git a/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/GenericJsonEventFormatterTest.cs b/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/GenericJsonEventFormatterTest.cs index 585ac5e..3765f46 100644 --- a/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/GenericJsonEventFormatterTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/GenericJsonEventFormatterTest.cs @@ -27,7 +27,7 @@ namespace CloudNative.CloudEvents.SystemTextJson.UnitTests var formatter = CreateFormatter(); var cloudEvent = formatter.DecodeStructuredModeMessage(bytes, null, null); - var model = (AttributedModel)cloudEvent.Data!; + var model = (AttributedModel) cloudEvent.Data!; Assert.Equal("test", model.AttributedProperty); } @@ -41,7 +41,7 @@ namespace CloudNative.CloudEvents.SystemTextJson.UnitTests var formatter = CreateFormatter(); var cloudEvent = formatter.DecodeStructuredModeMessage(bytes, new ContentType("text/plain"), null); - var model = (AttributedModel)cloudEvent.Data!; + var model = (AttributedModel) cloudEvent.Data!; Assert.Equal("test", model.AttributedProperty); } @@ -77,7 +77,7 @@ namespace CloudNative.CloudEvents.SystemTextJson.UnitTests var cloudEvent = new CloudEvent(); formatter.DecodeBinaryModeEventData(bytes, cloudEvent); - var model = (AttributedModel)cloudEvent.Data!; + var model = (AttributedModel) cloudEvent.Data!; Assert.Equal("test", model.AttributedProperty); } diff --git a/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/JsonEventFormatterTest.cs b/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/JsonEventFormatterTest.cs index dd48c50..af1ef0c 100644 --- a/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/JsonEventFormatterTest.cs +++ b/test/CloudNative.CloudEvents.UnitTests/SystemTextJson/JsonEventFormatterTest.cs @@ -435,7 +435,7 @@ namespace CloudNative.CloudEvents.SystemTextJson.UnitTests var array = BinaryDataUtilities.AsArray(data); Assert.Equal(array, SampleBinaryData); } - + // Note: batch mode testing is restricted to the batch aspects; we assume that the // per-CloudEvent implementation is shared with structured mode, so we rely on // structured mode testing for things like custom serialization. @@ -469,7 +469,7 @@ namespace CloudNative.CloudEvents.SystemTextJson.UnitTests Assert.Equal("application/cloudevents-batch+json; charset=utf-8", contentType.ToString()); var array = ParseJson(bytes).EnumerateArray().ToList(); Assert.Equal(2, array.Count); - + var asserter1 = new JsonElementAsserter { { "specversion", JsonValueKind.String, "1.0" }, @@ -672,10 +672,10 @@ namespace CloudNative.CloudEvents.SystemTextJson.UnitTests var formatter = new JsonEventFormatter(); var cloudEvent = formatter.DecodeStructuredModeMessage(bytes, s_jsonCloudEventContentType, AllTypesExtensions); Assert.Equal(SampleBinaryData, cloudEvent["binary"]); - Assert.True((bool)cloudEvent["boolean"]!); + Assert.True((bool) cloudEvent["boolean"]!); Assert.Equal(10, cloudEvent["integer"]); Assert.Equal("text", cloudEvent["string"]); - AssertTimestampsEqual(SampleTimestamp, (DateTimeOffset)cloudEvent["timestamp"]!); + AssertTimestampsEqual(SampleTimestamp, (DateTimeOffset) cloudEvent["timestamp"]!); Assert.Equal(SampleUri, cloudEvent["uri"]); Assert.Equal(SampleUriReference, cloudEvent["urireference"]); }