fsprojects / TickSpec

Lean .NET BDD framework with powerful F# integration
Apache License 2.0
133 stars 23 forks source link

Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' #9

Closed AbrahamAlcaina closed 6 years ago

AbrahamAlcaina commented 6 years ago

I'm trying to setup a project and I have the follow error :

    Features.Addition [FAIL]
      System.TypeInitializationException : The type initializer for '<StartupCode$tickspecbdd>.$Features' threw an exception.
      ---- System.IO.FileNotFoundException : Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
      Stack Trace:
           at Features.get_source()
           at Features.scenarios(String resourceName)
        ----- Inner Stack Trace -----
           at TickSpec.StepDefinitions..ctor(Type[] types)
           at Features.AssemblyStepDefinitionsSource..ctor(Assembly assembly)
           at <StartupCode$tickspecbdd>.$Features..cctor()
  Finished:    tickspecbdd

This is my code

module Features

open TickSpec
open Xunit

/// Represents a set of Step Definitions available within a given Assembly
type AssemblyStepDefinitionsSource(assembly : System.Reflection.Assembly) =
    let definitions = StepDefinitions(assembly)    
    /// Yields Scenarios generated by parsing the supplied Resource Name and binding the steps to their Step Definitions
    member __.ScenariosFromEmbeddedResource resourceName : Scenario seq =
        let stream = assembly.GetManifestResourceStream(resourceName)
        definitions.GenerateScenarios(resourceName, stream)

/// Adapts a Scenario Sequence to match the required format for an xUnit MemberData attribute
module MemberData =
    let ofScenarios xs = xs |> Seq.map (fun x -> [| x |])
let x =     System.Reflection.Assembly.GetExecutingAssembly()
System.Console.WriteLine(x)
let source = AssemblyStepDefinitionsSource(x)
System.Console.WriteLine(source)
let scenarios resourceName = source.ScenariosFromEmbeddedResource resourceName |> MemberData.ofScenarios

[<Theory; MemberData("scenarios", "Refunded.feature")>]
let Addition (scenario : Scenario) = scenario.Action.Invoke()

Any ideas?

AbrahamAlcaina commented 6 years ago

My fault I forgot to remove NoAppdomain in the xunit configuration