Skip to content

Tests are failing because of namespace order #21

@janis-veinbergs

Description

@janis-veinbergs

Hello.
Cloned solution, opened in VS2022 - build succeeds.
Running tests gets you reds all over

red-tests

For example, BooleanRemove complains:

    Assert.AreEqual failed. Expected:<<entities xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><entity name="knowledgearticle" displayname="Knowledge Article"><records><record id="f835a513-ed9e-e711-9401-0003ff66fbff"><field name="expirationstateid" value="3" /><field name="knowledgearticleid" value="f835a513-ed9e-e711-9401-0003ff66fbff" /></record></records><m2mrelationships /></entity></entities>>. Actual:<<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><entity name="knowledgearticle" displayname="Knowledge Article"><records><record id="f835a513-ed9e-e711-9401-0003ff66fbff"><field name="expirationstateid" value="3" /><field name="knowledgearticleid" value="f835a513-ed9e-e711-9401-0003ff66fbff" /></record></records><m2mrelationships /></entity></entities>>. 

Notice the namespace order is different
winmerge - diff beteween namespaces

I don't know what causes this undeterministic behavior... would it be OK if I make PR which "normalizes" xml before comparison in a way that it sorts namespaces?

Another option would be custom XmlWriter https://stackoverflow.com/questions/20701750/c-sharp-xml-serialization-order-of-namespace-declarations

I tried to tinker with code but I don't know how to influence serializing namespace order. Moreover I tried the said stackoverflow serializer and the result was the namespaces were not sorted but gone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions