-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API Implementation]: Expose CookieException constructors #109026
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,11 +14,28 @@ public CookieException() : base() | |||||||||
{ | ||||||||||
} | ||||||||||
|
||||||||||
internal CookieException(string? message) : base(message) | ||||||||||
/// <summary> | ||||||||||
/// Initializes a new instance of the <see cref='CookieException'/> class with the specified error message. | ||||||||||
/// </summary> | ||||||||||
/// <param name="message">A <see cref="string"/> that describes the error that occurred.</param> | ||||||||||
/// <remarks> | ||||||||||
/// The value of <paramref name="message"/> is stored in the <see cref="Exception.Message"/> property of the new instance. | ||||||||||
/// </remarks> | ||||||||||
public CookieException(string? message) : base(message) | ||||||||||
{ | ||||||||||
} | ||||||||||
|
||||||||||
internal CookieException(string? message, Exception? inner) : base(message, inner) | ||||||||||
/// <summary> | ||||||||||
/// Initializes a new instance of the <see cref='CookieException'/> class with the specified error message | ||||||||||
/// and a reference to the inner exception that is the cause of this exception. | ||||||||||
/// </summary> | ||||||||||
/// <param name="message">A <see cref="string"/> that describes the error that occurred.</param> | ||||||||||
/// <param name="innerException">A nested <see cref="Exception"/>.</param> | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
/// <remarks> | ||||||||||
/// The value of <paramref name="message"/> is stored in the <see cref="Exception.Message"/> property of the new instance. | ||||||||||
/// The value of <paramref name="message"/> is stored in the <see cref="Exception.InnerException"/> property of the new instance. | ||||||||||
/// </remarks> | ||||||||||
Comment on lines
+34
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
public CookieException(string? message, Exception? innerException) : base(message, innerException) | ||||||||||
{ | ||||||||||
} | ||||||||||
|
||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you'll have to include a reference to the new file in the test |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,32 @@ | ||||||
// Licensed to the .NET Foundation under one or more agreements. | ||||||
// The .NET Foundation licenses this file to you under the MIT license. | ||||||
|
||||||
using Xunit; | ||||||
|
||||||
namespace System.Net.Primitives.UnitTests.Tests; | ||||||
|
||||||
public sealed class CookieExceptionTest | ||||||
{ | ||||||
[Theory] | ||||||
[InlineData("Testing the CookieException")] | ||||||
[InlineData(null)] | ||||||
public void Constructor_Message(string? message) | ||||||
{ | ||||||
var exception = new CookieException(message); | ||||||
Assert.Equal(message, exception.Message); | ||||||
} | ||||||
|
||||||
[Theory] | ||||||
[InlineData("Testing the CookieException", true)] | ||||||
[InlineData("Testing the CookieException", false)] | ||||||
[InlineData(null, true)] | ||||||
[InlineData(null, false)] | ||||||
public void Constructor_Message_InnerException(string? message, bool innerException) | ||||||
{ | ||||||
var inner = innerException ? new Exception() : null; | ||||||
var exception = new CookieException(message, inner); | ||||||
|
||||||
Assert.Equal(message, exception.Message); | ||||||
Assert.Equal(inner, exception.InnerException); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There would be no difference in result, if I use Same. |
||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.