Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert.Equivalent return incorrect result when compare decimal #2913

Closed
msighkertsui opened this issue Apr 9, 2024 · 2 comments
Closed

Assert.Equivalent return incorrect result when compare decimal #2913

msighkertsui opened this issue Apr 9, 2024 · 2 comments

Comments

@msighkertsui
Copy link

Assert.Equivalent does not compare the value of two decimal value.

Sample code 1:
Assert.Equivalent(1m, 2m)

Expected result:
Exception throw

Observation:
Statement run successfully

Sample code 2:

class TestObject {
    public decimal Value { get; set; }
}

Assert.Equivalent(new TestObject() {Value = 1m}, new TestObject() {Value = 2m}) ;

Expected result:
Exception throw

Observation:
Statement run successfully

@bradwilson
Copy link
Member

Wow, TIL that Type.IsPrimitive returns false for decimals.

@bradwilson
Copy link
Member

Available in v2 2.7.1-pre.15
Available in v3 0.1.1-pre.392

https://xunit.net/docs/using-ci-builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants