private IEnumerable <FooGuid> GetEntities(int count = 10) { var result = new List <FooGuid>(); // Add entities to context for (var i = 1; i <= count; i++) { var foo = new FooGuid { Id = _keys[i] }; result.Add(foo); } return(result); }
public void Guid_works() { Coordinator.Configure(options => options.DataProtectionProvider = DataProtectionProvider.Create("test")); var myGuid = Guid.NewGuid(); var foo = new FooGuid { MyGuid = myGuid }; var json = JsonSerializer.Serialize(foo); // make sure it's encrypted using (var jsonDoc = JsonDocument.Parse(json)) { var jsonProperty = jsonDoc.RootElement.GetProperty(nameof(FooGuid.MyGuid)); jsonProperty.ValueKind.ShouldBe(JsonValueKind.String); jsonProperty.GetString().ShouldNotBe(myGuid.ToString()); } // decrypt and check var decrypted = JsonSerializer.Deserialize <FooGuid>(json); decrypted.MyGuid.ShouldBe(myGuid); }