public void NullException() { using (var client = new DatumClient()) { client.LogException(null); } }
public void LogError() { var err = this.Error(); using (var client = new DatumClient()) { client.LogException(err); } var app = new Application(); var table = new AzureTable <Server.ErrorData>(CloudStorageAccount.DevelopmentStorageAccount); var errors = table.QueryByPartition(err.Token.ApplicationId.ToString()).ToList(); Assert.IsNotNull(errors, "Errors should not be null"); var error = (from data in errors where err.Message == data.Message select data).FirstOrDefault(); Assert.IsNotNull(error, "Error should not be null"); Assert.AreEqual <Guid>(err.Token.ApplicationId, error.ApplicationId, "Application Id should match"); Assert.AreEqual <DateTime>(err.OccurredOn.Date, error.OccurredOn.Date, "Occured On should match"); Assert.AreEqual <string>(err.MachineName, error.MachineName, "Machine Name should match"); Assert.AreEqual <string>(err.Message, error.Message, "Message should match"); Assert.AreEqual <string>(err.ClassName, error.ClassName, "Type should match"); Assert.AreEqual <int>(err.ErrorCode, error.ErrorCode, "Error Code should match"); Assert.AreEqual <int>((int)err.EventType, error.EventTypeValue, "Event Type should match"); }
public void ExceptionEmptyAppId() { using (var client = new DatumClient()) { var err = this.Error(); err.Token.ApplicationId = Guid.Empty; client.LogException(err); } }
public void NullExceptionToken() { using (var client = new DatumClient()) { var err = this.Error(); err.Token = null; client.LogException(err); } }
public void ExceptionInvalidType() { using (var client = new DatumClient()) { var err = this.Error(); err.ClassName = StringHelper.NullEmptyWhiteSpace(); client.LogException(err); } }
public void LogErrorWithParents() { var err = this.Error(); var parentA = this.Error(); parentA.Token.ApplicationId = err.Token.ApplicationId; var parentB = this.Error(); parentB.Token.ApplicationId = err.Token.ApplicationId; err.Parent = parentA; parentA.Parent = parentB; using (var client = new DatumClient()) { client.LogException(err); } var source = new Server.Core.LogCore(); var query = new Server.Contracts.LogQuery() { ApplicationIdentifier = err.Token.ApplicationId, }; var errors = source.SelectErrors(query); Assert.IsNotNull(errors, "Errors should not be null"); ErrorItem data; foreach (var error in errors) { if (error.Message == err.Message) { data = err; } else if (error.Message == parentB.Message) { data = parentB; } else if (error.Message == parentA.Message) { data = parentA; } else { continue; } Assert.IsNotNull(error, "Error should not be null"); Assert.AreEqual <Guid>(data.Token.ApplicationId, error.Token.ApplicationId, "Application Id should match"); Assert.AreEqual <string>(data.MachineName, error.MachineName, "Machine Name should match"); Assert.AreEqual <string>(data.Message, error.Message, "Message should match"); Assert.AreEqual <string>(data.ClassName, error.ClassName, "Type should match"); Assert.AreEqual <int>(data.ErrorCode, error.ErrorCode, "Error Code should match"); Assert.AreEqual <DateTime>(data.OccurredOn.Date, error.OccurredOn.Date, "Occured On should match"); } }