Skip to content

Commit 6133bec

Browse files
committed
- Part 3
1 parent c3e76bb commit 6133bec

14 files changed

+2424
-251
lines changed

src/MongoDB.Bson/Exceptions/BsonException.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public BsonException(string format, params object[] args)
6666
/// </summary>
6767
/// <param name="info">The SerializationInfo.</param>
6868
/// <param name="context">The StreamingContext.</param>
69+
[Obsolete("Legacy serialization support APIs are obsolete: SYSLIB0051")]
6970
public BsonException(SerializationInfo info, StreamingContext context)
7071
: base(info, context)
7172
{

src/MongoDB.Bson/Exceptions/BsonInternalException.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public BsonInternalException(string message, Exception innerException)
5656
/// </summary>
5757
/// <param name="info">The SerializationInfo.</param>
5858
/// <param name="context">The StreamingContext.</param>
59+
[Obsolete("Legacy serialization support APIs are obsolete: SYSLIB0051")]
5960
public BsonInternalException(SerializationInfo info, StreamingContext context)
6061
: base(info, context)
6162
{

src/MongoDB.Bson/Exceptions/BsonSerializationException.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public BsonSerializationException(string message, Exception innerException)
5656
/// </summary>
5757
/// <param name="info">The SerializationInfo.</param>
5858
/// <param name="context">The StreamingContext.</param>
59+
[Obsolete("Legacy serialization support APIs are obsolete: SYSLIB0051")]
5960
public BsonSerializationException(SerializationInfo info, StreamingContext context)
6061
: base(info, context)
6162
{

src/MongoDB.Bson/Exceptions/DuplicateBsonMemberMapAttributeException.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public DuplicateBsonMemberMapAttributeException(string message, Exception inner)
4848
/// </summary>
4949
/// <param name="info">The info.</param>
5050
/// <param name="context">The context.</param>
51+
[Obsolete("Legacy serialization support APIs are obsolete: SYSLIB0051")]
5152
protected DuplicateBsonMemberMapAttributeException(SerializationInfo info, StreamingContext context)
5253
: base(info, context)
5354
{

src/MongoDB.Bson/Exceptions/TruncationException.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public TruncationException(string message, Exception innerException)
5656
/// </summary>
5757
/// <param name="info">The SerializationInfo.</param>
5858
/// <param name="context">The StreamingContext.</param>
59+
[Obsolete("Legacy serialization support APIs are obsolete: SYSLIB0051")]
5960
public TruncationException(SerializationInfo info, StreamingContext context)
6061
: base(info, context)
6162
{
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* Copyright 2010-present MongoDB Inc.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
using System;
17+
using FluentAssertions;
18+
using Xunit;
19+
20+
namespace MongoDB.Bson.Tests.Exceptions
21+
{
22+
public class BsonSerializationExceptionTests
23+
{
24+
[Fact]
25+
public void Constructor_with_message_and_inner_exception_should_initialize_properties()
26+
{
27+
// Arrange
28+
var message = "Test error message";
29+
var innerException = new ArgumentException("Inner exception message");
30+
31+
// Act
32+
var exception = new BsonSerializationException(message, innerException);
33+
34+
// Assert
35+
exception.Message.Should().Be(message);
36+
exception.InnerException.Should().BeSameAs(innerException);
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)