public void DistribuitedException_WithMessage() { var sut = new DistribuitedException("Test"); var expected = new StringBuilder("Runtime:\r\n") .AppendLine(string.Format("MachineName = {0}", Environment.MachineName)) .AppendLine(string.Format("AppDomainName = {0}", AppDomain.CurrentDomain.FriendlyName)) .AppendLine(string.Format("WindowsIdentityName = {0}", WindowsIdentity.GetCurrent().Name)) .AppendLine(string.Format("ThreadIdentityName = {0}", Thread.CurrentPrincipal.Identity.Name)) .Append("Infrastructure.Core.Exceptions.DistribuitedException: Test") .ToString(); sut.ToString().Should().Be(expected); }
public void DistribuitedException_WithMessageAndException() { var doc = new Exception(); var sut = new DistribuitedException("Test", doc); var expected = new StringBuilder("Runtime:\r\n") .AppendLine(string.Format("MachineName = {0}", Environment.MachineName)) .AppendLine(string.Format("AppDomainName = {0}", AppDomain.CurrentDomain.FriendlyName)) .AppendLine(string.Format("WindowsIdentityName = {0}", WindowsIdentity.GetCurrent().Name)) .AppendLine(string.Format("ThreadIdentityName = {0}", Thread.CurrentPrincipal.Identity.Name)) .Append("Infrastructure.Core.Exceptions.DistribuitedException: Test ---> System.Exception: Exception of type 'System.Exception' was thrown.\r\n --- End of inner exception stack trace ---") .ToString(); sut.ToString().Should().Be(expected); }