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 @@ namespace NzbDrone.Services.Service.Controllers
ExceptionHash = existingExceptionReport.Hash,
IsProduction = existingExceptionReport.IsProduction,
LogMessage = existingExceptionReport.LogMessage,
UGuid = existingExceptionReport.UGuid,
Timestamp = DateTime.Now
};
@ -64,7 +65,8 @@ namespace NzbDrone.Services.Service.Controllers
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 @@ namespace NzbDrone.Services.Service.Migrations
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 @@ namespace NzbDrone.Services.Service.Repository.Reporting
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 @@ namespace NzbDrone.Services.Tests.ExceptionControllerTests
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 @@ namespace NzbDrone.Services.Tests.ExceptionControllerTests
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]