Skip to content

Commit

Permalink
Add FaultException ctor with String as param (#4270)
Browse files Browse the repository at this point in the history
  • Loading branch information
imcarolwang committed Sep 2, 2020
1 parent e3b54a4 commit 4c197f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ public FaultContractAttribute(System.Type detailType) { }
public partial class FaultException : System.ServiceModel.CommunicationException
{
public FaultException() { }
public FaultException(string reason) { }
public FaultException(System.ServiceModel.Channels.MessageFault fault, string action) { }
public FaultException(System.ServiceModel.FaultReason reason, System.ServiceModel.FaultCode code, string action) { }
protected FaultException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,15 @@ public static void Serializable_Default()
Assert.Equal(netfxBsl, sr.ReadToEnd());
}
}

[WcfFact]
public static void Ctor_StringReason()
{
string reason = "Fault reason";
var exception = new FaultException(reason);
Assert.NotNull(exception);
Assert.NotNull(exception.Reason);
Assert.NotNull(exception.Code);
Assert.Equal(reason, exception.Reason.ToString());
}
}

0 comments on commit 4c197f4

Please sign in to comment.