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

XmlAsserts.Equal fails if node has multiline text and the tab indentation is not matched #13

Open
MichaelJohnBradley opened this issue Oct 19, 2021 · 3 comments

Comments

@MichaelJohnBradley
Copy link

i have got an assert such as
XmlAssert.Equal(expected, actual, XmlAssertOptions.IgnoreNamespaces);
if i have xml document like this

<NodeOne>
	<DescriptionText>
		Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ullamcorper ut arcu vitae fringilla. Donec et laoreet arcu, ac condimentum lectus. Pellentesque
		enim sem, gravida congue placerat eget, iaculis a orci. Nam cursus venenatis turpis vitae accumsan. Vivamus varius orci turpis, in consequat ante consectetur
		eu. Integer dictum efficitur varius. Nulla ipsum ligula, molestie id lorem a, pulvinar sollicitudin purus. Ut tempor, lectus et rutrum imperdiet, eros ipsum congue
	</DescriptionText>
</NodeOne>

note the indentation.

i then select the DescriptionText node by using linq. This is what i use for my "actual" xml value

I have an expected xml of:

<DescriptionText>
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ullamcorper ut arcu vitae fringilla. Donec et laoreet arcu, ac condimentum lectus. Pellentesque
	enim sem, gravida congue placerat eget, iaculis a orci. Nam cursus venenatis turpis vitae accumsan. Vivamus varius orci turpis, in consequat ante consectetur
	eu. Integer dictum efficitur varius. Nulla ipsum ligula, molestie id lorem a, pulvinar sollicitudin purus. Ut tempor, lectus et rutrum imperdiet, eros ipsum congue
</DescriptionText>

the equality assert fails because the tab indentaton is not the same. instead i have got to have an expected xml of :

<DescriptionText>
		Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ullamcorper ut arcu vitae fringilla. Donec et laoreet arcu, ac condimentum lectus. Pellentesque
		enim sem, gravida congue placerat eget, iaculis a orci. Nam cursus venenatis turpis vitae accumsan. Vivamus varius orci turpis, in consequat ante consectetur
		eu. Integer dictum efficitur varius. Nulla ipsum ligula, molestie id lorem a, pulvinar sollicitudin purus. Ut tempor, lectus et rutrum imperdiet, eros ipsum congue
	</DescriptionText>

is this expected behaviour? Is there a way to ignore the indentation or tabs.

@JohanLarsson
Copy link
Member

Hello, this sounds like a bug, thank you for reporting.
This library never became nice, sorry about that.

@MichaelJohnBradley
Copy link
Author

Hi - are you still maintaining this project? Is this something you will be looking into and maybe fixing?
Thanks.

@JohanLarsson
Copy link
Member

I have not used this project much tbh and been pretty busy lately so can't promise a fix anytime soon. The issue is good though, thank you for it!

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

No branches or pull requests

2 participants