1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-11 12:02:35 +02:00

Added uguid to exceptioninstance

This commit is contained in:
kay.one 2012-02-29 23:58:11 -08:00
parent 245e122c61
commit 969c36912d
5 changed files with 17 additions and 4 deletions

View File

@ -33,6 +33,7 @@ public EmptyResult ReportExisting(ExistingExceptionReport existingExceptionRepor
ExceptionHash = existingExceptionReport.Hash,
IsProduction = existingExceptionReport.IsProduction,
LogMessage = existingExceptionReport.LogMessage,
UGuid = existingExceptionReport.UGuid,
Timestamp = DateTime.Now
};
@ -64,7 +65,8 @@ public JsonResult ReportNew(ExceptionReport exceptionReport)
ExceptionHash = exceptionHash,
IsProduction = exceptionReport.IsProduction,
LogMessage = exceptionReport.LogMessage,
Timestamp = DateTime.Now
Timestamp = DateTime.Now,
UGuid = exceptionReport.UGuid
};
_database.Insert(exceptionInstance);

View File

@ -14,6 +14,7 @@ public override void Up()
new Column("ExceptionHash", DbType.String, ColumnProperty.NotNull),
new Column("LogMessage", DbType.String, 3000, ColumnProperty.NotNull),
MigrationsHelper.TimestampColumn,
MigrationsHelper.UGuidColumn,
MigrationsHelper.ProductionColumn);
Database.AddTable("Exceptions", new Column("Hash", DbType.String, ColumnProperty.Unique),

View File

@ -12,5 +12,6 @@ public class ExceptionInstance
public string LogMessage { get; set; }
public DateTime Timestamp { get; set; }
public bool IsProduction { get; set; }
public Guid UGuid { get; set; }
}
}

View File

@ -53,13 +53,21 @@ public void should_save_instance_if_hash_is_valid()
WithRealDb();
var existing = CreateExceptionReport();
Db.Insert(Builder<ExceptionDetail>.CreateNew().With(c => c.Hash = existing.Hash).Build());
Controller.ReportExisting(CreateExceptionReport());
Controller.ReportExisting(existing);
Db.Fetch<ExceptionDetail>().Should().HaveCount(1);
Db.Fetch<ExceptionInstance>().Should().HaveCount(1);
var exceptionInstance = Db.Fetch<ExceptionInstance>();
exceptionInstance.Should().HaveCount(1);
exceptionInstance.Single().Id.Should().BeGreaterThan(0);
exceptionInstance.Single().ExceptionHash.Should().NotBeBlank();
exceptionInstance.Single().IsProduction.Should().Be(existing.IsProduction);
exceptionInstance.Single().Timestamp.Should().BeWithin(TimeSpan.FromSeconds(4)).Before(DateTime.Now);
exceptionInstance.Single().LogMessage.Should().Be(existing.LogMessage);
exceptionInstance.Single().UGuid.Should().Be(existing.UGuid);
}
}

View File

@ -92,6 +92,7 @@ public void ReportNew_should_save_instance()
exceptionInstance.Single().IsProduction.Should().Be(exceptionReport.IsProduction);
exceptionInstance.Single().Timestamp.Should().BeWithin(TimeSpan.FromSeconds(4)).Before(DateTime.Now);
exceptionInstance.Single().LogMessage.Should().Be(exceptionReport.LogMessage);
exceptionInstance.Single().UGuid.Should().Be(exceptionReport.UGuid);
}
[Test]