小编Rac*_*ael的帖子

比较时如何让 FluentAssertions ShouldBeEquivalentTo 检查类型?

我有 2 个字典,我希望内容不相同,因为字典包含不同类型的值。但是下面的测试通过

[Scenario]
public void DictionariesWithDifferentTypesShouldBeEquivalent(
    Dictionary<string, object> firstDictionary, 
    Dictionary<string, object> secondDictionary)
{
    "Given a dictionary"
        .f(() => firstDictionary = new Dictionary<string, object> 
                    {
                        { "latency", 0 },
                        { "errorMessages", new string[0] },
                        { "lastChanged", new DateTime(635272310930829706) },
                        { "query", new string[0] },
                        { "items", new string[] { "foo", "bar" } },
                        { "name", "Bob" },
                        { "number", 3 },
                        { "updateInterval", 10 },
                    });

    "And a second dictionary with same values but of differing types"
        .f(() => secondDictionary …
Run Code Online (Sandbox Code Playgroud)

c# fluent-assertions

5
推荐指数
1
解决办法
3639
查看次数

标签 统计

c# ×1

fluent-assertions ×1