コード例 #1
0
    public void Factory_creates_expected_comparer(Type expectedComparer, string property)
    {
        using var context = new GodzillaContext();

        var factory = new CurrentValueComparerFactory();

        Assert.IsType(expectedComparer, factory.Create(context.Model.FindEntityType(typeof(Godzilla)).FindProperty(property)));
    }
コード例 #2
0
    public void Factory_throws_if_model_and_provider_type_are_not_comparable()
    {
        using var context = new GodzillaContext();

        var factory = new CurrentValueComparerFactory();

        Assert.Equal(
            CoreStrings.NonComparableKeyTypes(
                nameof(Godzilla), nameof(Godzilla.NotComparableConverted), nameof(NotComparable), nameof(NotComparable)),
            Assert.Throws <InvalidOperationException>(
                () => factory.Create(
                    context.Model.FindEntityType(typeof(Godzilla)).FindProperty(nameof(Godzilla.NotComparableConverted)))).Message);
    }