F# Метод не найден: 'Microsoft.FSharp.Collections.FSharpList`1<Table>'

У меня есть следующие типы, определенные в моей сборке:

type DatabaseDifferences = {missingTables: Table list}
type ComparisonResult = IsMatch | Differences of DatabaseDifferences

Затем из моей тестовой сборки, когда я пытаюсь посмотреть на длину Table list на DatabaseDifferences типа я получаю следующую ошибку: System.MissingMethodExceptionMethod not found: 'Microsoft.FSharp.Collections.FSharpList``1<Table> DatabaseDifferences.get_missingTables()'.

Вот сокращенный тест, который воспроизводит проблему:

let extractDifferences r =
    match r with
    | Differences(r') -> r'
    | _ -> failwith "expected databases to be different but they are a match"

[<Fact>]
let ``fail example``() =

    let d = Differences{missingTables = []} |> extractDifferences
    d.missingTables.Length |> should equal 0

Если я объявляю типы в той же сборке, что и тесты, то все работает, например, этот код проходит (тип Table все еще определен в другой сборке):

type diff = {missingTables: Table list}
type cr = IsMatch | Diffs of diff

let extract r =
    match r with
    | Diffs(r') -> r'
    | _ -> failwith "expected databases to be different but they are a match"

[<Fact>]
let ``fail example 2``() =

    let d = Diffs{missingTables = []} |> extract
    d.missingTables.Length |> should equal 0

Я использую F# core версии 4 и.Net версии 4.6.2 в обеих сборках

0 ответов

Другие вопросы по тегам