public void ErrorSameType() { var fulcrumError = new FulcrumError { Type = FulcrumConflictException.ExceptionType, TechnicalMessage = Guid.NewGuid().ToString(), FriendlyMessage = Guid.NewGuid().ToString(), InstanceId = Guid.NewGuid().ToString(), CorrelationId = Guid.NewGuid().ToString(), Code = Guid.NewGuid().ToString(), ErrorLocation = Guid.NewGuid().ToString(), IsRetryMeaningful = true, MoreInfoUrl = Guid.NewGuid().ToString(), RecommendedWaitTimeInSeconds = 100.0, ServerTechnicalName = Guid.NewGuid().ToString() }; var fulcrumException = new FulcrumConflictException(Guid.NewGuid().ToString()); fulcrumException.CopyFrom(fulcrumError); // Equal UT.Assert.AreEqual(fulcrumError.Code, fulcrumException.Code); UT.Assert.AreEqual(fulcrumError.RecommendedWaitTimeInSeconds, fulcrumException.RecommendedWaitTimeInSeconds); UT.Assert.AreEqual(fulcrumError.ServerTechnicalName, fulcrumException.ServerTechnicalName); UT.Assert.AreEqual(fulcrumError.FriendlyMessage, fulcrumException.FriendlyMessage); UT.Assert.AreEqual(fulcrumError.Type, fulcrumException.Type); UT.Assert.AreEqual(fulcrumError.MoreInfoUrl, fulcrumException.MoreInfoUrl); UT.Assert.AreEqual(fulcrumError.ServerTechnicalName, fulcrumException.ServerTechnicalName); UT.Assert.AreEqual(fulcrumError.CorrelationId, fulcrumException.CorrelationId); UT.Assert.AreEqual(fulcrumError.InstanceId, fulcrumException.InstanceId); UT.Assert.AreEqual(fulcrumError.IsRetryMeaningful, fulcrumException.IsRetryMeaningful); UT.Assert.AreEqual(fulcrumError.ErrorLocation, fulcrumException.ErrorLocation); // NOT equal // Other tests UT.Assert.IsNull(fulcrumException.InnerException); UT.Assert.AreEqual(fulcrumException.TechnicalMessage, fulcrumException.Message); }
public void ExceptionToErrorAndBack() { var fulcrumException = new FulcrumConflictException(Guid.NewGuid().ToString()) { TechnicalMessage = Guid.NewGuid().ToString(), FriendlyMessage = Guid.NewGuid().ToString(), CorrelationId = Guid.NewGuid().ToString(), Code = Guid.NewGuid().ToString(), ErrorLocation = Guid.NewGuid().ToString(), MoreInfoUrl = Guid.NewGuid().ToString(), RecommendedWaitTimeInSeconds = 100.0, ServerTechnicalName = Guid.NewGuid().ToString() }; var fulcrumError = new FulcrumError(); fulcrumError.CopyFrom(fulcrumException); var copy = new FulcrumConflictException(fulcrumError.TechnicalMessage); copy.CopyFrom(fulcrumError); // Equal UT.Assert.AreEqual(fulcrumError.Code, copy.Code); UT.Assert.AreEqual(fulcrumError.RecommendedWaitTimeInSeconds, copy.RecommendedWaitTimeInSeconds); UT.Assert.AreEqual(fulcrumError.ServerTechnicalName, copy.ServerTechnicalName); UT.Assert.AreEqual(fulcrumError.FriendlyMessage, copy.FriendlyMessage); UT.Assert.AreEqual(fulcrumError.Type, copy.Type); UT.Assert.AreEqual(fulcrumError.MoreInfoUrl, copy.MoreInfoUrl); UT.Assert.AreEqual(fulcrumError.ServerTechnicalName, copy.ServerTechnicalName); UT.Assert.AreEqual(fulcrumError.InstanceId, copy.InstanceId); UT.Assert.AreEqual(fulcrumError.IsRetryMeaningful, copy.IsRetryMeaningful); UT.Assert.AreEqual(fulcrumError.CorrelationId, copy.CorrelationId); UT.Assert.AreEqual(fulcrumError.ErrorLocation, copy.ErrorLocation); // Other tests UT.Assert.IsNull(copy.InnerException); }