Skip to content

Commit

Permalink
- Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisDog committed Oct 4, 2022
1 parent e5665fb commit a4ec080
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 34 deletions.
30 changes: 1 addition & 29 deletions src/MongoDB.Bson/Serialization/Serializers/EnumSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace MongoDB.Bson.Serialization.Serializers
/// Represents a serializer for enums.
/// </summary>
/// <typeparam name="TEnum">The type of the enum.</typeparam>
public class EnumSerializer<TEnum> : StructSerializerBase<TEnum>, IRepresentationConfigurable<EnumSerializer<TEnum>>, IEquatable<EnumSerializer<TEnum>> where TEnum : struct, Enum
public class EnumSerializer<TEnum> : StructSerializerBase<TEnum>, IRepresentationConfigurable<EnumSerializer<TEnum>> where TEnum : struct, Enum
{
// private fields
private readonly BsonType _representation;
Expand Down Expand Up @@ -253,33 +253,5 @@ private TEnum ConvertStringToEnum(string value)
// fall back to case-insensitive parse
return (TEnum)Enum.Parse(typeof(TEnum), value, ignoreCase: true);
}

/// <summary>
/// adsf
/// </summary>
/// <returns></returns>
public override int GetHashCode() => base.GetHashCode();

/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public override bool Equals(object obj)
{
EnumSerializer<TEnum> other = obj as EnumSerializer<TEnum>;

if (other == null)
return false;

return other._representation == _representation;
}

/// <summary>
///
/// </summary>
/// <param name="other"></param>
/// <returns></returns>
public bool Equals(EnumSerializer<TEnum> other) => Equals(other as object);
}
}
17 changes: 16 additions & 1 deletion tests/MongoDB.Driver.Core.TestHelpers/Logging/ILoggingService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
using MongoDB.Driver.Core.Configuration;
/* Copyright 2010-present MongoDB Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using MongoDB.Driver.Core.Configuration;

namespace MongoDB.Driver.Core.TestHelpers.Logging
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
using Microsoft.Extensions.Logging.Abstractions;
/* Copyright 2010-present MongoDB Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using Microsoft.Extensions.Logging.Abstractions;
using MongoDB.Driver.Core.Configuration;

namespace MongoDB.Driver.Core.TestHelpers.Logging
{
public sealed class NullLoggingService : ILoggingService
{
public LoggingSettings LoggingSettings { get; } = new LoggingSettings(NullLoggerFactory.Instance);
public LogEntry[] Logs { get; } = new LogEntry[0];

public static ILoggingService Instance = new NullLoggingService();

private NullLoggingService() { }

public LoggingSettings LoggingSettings { get; } = new LoggingSettings(NullLoggerFactory.Instance);
public LogEntry[] Logs { get; } = new LogEntry[0];
}
}

0 comments on commit a4ec080

Please sign in to comment.