Datetime scraping in XElement #771
-
Hello, I am working with XElements and one of the Nodes has an Attribute for date and time, which is always set to DateTime.Now(). I saw in the documentation that I need to use "DateTime_1" as the value in the verified file. However, this does not seem to work. Can someone help me with this, I am attaching a screenshot of the failed test. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
thats a bug. can u try v 19.8.2 |
Beta Was this translation helpful? Give feedback.
-
I get file:
{
BirthDate: DateTime_1,
Name: Test
}
after running test:
[UsesVerify]
public class DateTimeTest
{
class Person
{
public DateTime BirthDate { get; set; }
public string Name { get; set; }
}
[Fact]
public async Task BirthDateShouldSerializeAsDateTime()
{
var p = new Person { Name = "Test", BirthDate = new
DateTime(1980, 1, 1) };
await Verifier.Verify(p);
}
}
…On Tue, Feb 28, 2023 at 10:48 AM Simon Cropp ***@***.***> wrote:
@uuuus <https://github.com/uuuus> i will need a repro
—
Reply to this email directly, view it on GitHub
<#771 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLUXSMAYUUXDDOQVX47IEDWZXCWZANCNFSM6AAAAAAUGDXEGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I see.
Is there any single setting to be sure that complete object is serialized
with all original values?
I have class with property:
public int Value { get; set; }
When Value = 0 property is not serialized.
…On Thu, Mar 2, 2023 at 9:51 AM Simon Cropp ***@***.***> wrote:
@uuuus <https://github.com/uuuus> thats how it should be working. if u
want to disable date scrubbing see
https://github.com/VerifyTests/Verify/blob/main/docs/serializer-settings.md#snippet-dontscrubdatetimesfluent
—
Reply to this email directly, view it on GitHub
<#771 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLUXSNVGXGRMQEISHWPYLLW2BNSXANCNFSM6AAAAAAUGDXEGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
thats a bug. can u try v 19.8.2