Размер видео: 1280 X 720853 X 480640 X 360
Показать панель управления
Автовоспроизведение
Автоповтор
How can I used BeEquivalentTo to compare ActualObject.Flied=null and ExpectedObject.Filed = String.Empty and get they are equivalent?
They’re not equivalent. Null and empty string are different values in C#.The best you could do is tell fluent assertions to ignore that field.
@@themusingsofadev3565 I can't ignore because I want to compare other values to be equals
Then I would override the equals method on your class if possible, otherwise I think you’re out of luck. You could always ignore it on that test and then write a specific test for the empty string null problem
@@themusingsofadev3565 I need a generic solution for every model that I read form a csv or xlsx, you know, string null becomes string empty in a file
@@themusingsofadev3565now you understand?
How can I used BeEquivalentTo to compare ActualObject.Flied=null and ExpectedObject.Filed = String.Empty and get they are equivalent?
They’re not equivalent. Null and empty string are different values in C#.
The best you could do is tell fluent assertions to ignore that field.
@@themusingsofadev3565 I can't ignore because I want to compare other values to be equals
Then I would override the equals method on your class if possible, otherwise I think you’re out of luck. You could always ignore it on that test and then write a specific test for the empty string null problem
@@themusingsofadev3565 I need a generic solution for every model that I read form a csv or xlsx, you know, string null becomes string empty in a file
@@themusingsofadev3565now you understand?