Skip to content

Commit

Permalink
Storing record in relation throws misleading exception (#149)
Browse files Browse the repository at this point in the history
Co-authored-by: Vladimír Kleštinec <[email protected]>
  • Loading branch information
klesta490 and Vladimír Kleštinec authored Jul 31, 2024
1 parent e1f8a44 commit 8e2ec20
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions BTDBTest/ObjectDbTableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3082,6 +3082,30 @@ void DictionaryWithReadOnlyMemoryCanBeStored()
Assert.Equal(new byte[] {1, 2, 3}, item.Dict["a"].ToArray());
Assert.Equal(new byte[] {4, 5, 6}, item.Dict["b"].ToArray());
}

public record PlannedMigrationStartInfo(ulong ActionId, DateTime PlannedStartDateTime);

public class ActionItem
{
public PlannedMigrationStartInfo PlannedMigrationStart { get; set; }
}

public interface IActionTable : IRelation<ActionItem>
{
}

[Fact]
public void GivenRecordToStore_ThrowsFancyException()
{
using var tr = _db.StartTransaction();
var rel = tr.GetRelation<IActionTable>();
var exception = Assert.Throws<BTDBException>(() =>
{
rel.Upsert(new () { PlannedMigrationStart = new (1, DateTime.UtcNow) });
tr.Commit();
});
Assert.DoesNotContain("Type System.RuntimeType is not registered.", exception.Message);
}
}
}

Expand Down

0 comments on commit 8e2ec20

Please sign in to comment.