Skip to content

Commit

Permalink
Test user-provided type converters don't break winforms overwrites
Browse files Browse the repository at this point in the history
  • Loading branch information
farlee2121 committed Nov 22, 2023
1 parent 0322c58 commit 96dd85a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Tests/ResxDataNodeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,34 @@ public void ResxDataNode_ResXFileRefsWrittenBackWithSameAssemblyInfo()

Assert.Equal(originalResx, writerOutput.ToString());
}

[Fact]
public void ResxDataNode_CustomTypeConvertersDontOverwriteDefaultConverters()
{
string expectedIntTypeName = "some-text";
string customTypeConverter(Type type)
{
if (type == typeof(int)) return expectedIntTypeName;
else return null;
}

var intNode = new ResXDataNode("int-node", 1, customTypeConverter);

var fileRefNode = new ResXDataNode("file-node", new ResXFileRef("i-am-file.txt", typeof(string).AssemblyQualifiedName), customTypeConverter);


var expected =
(
("int-node", expectedIntTypeName),
("file-node", NetStandard.ResXConstants.ResxFileRefTypeInfo)
);
var actual =
(
("int-node", intNode.GetDataNodeInfo().TypeName),
("file-node", fileRefNode.GetDataNodeInfo().TypeName)
);

Assert.Equal(expected, actual);
}
}
}

0 comments on commit 96dd85a

Please sign in to comment.