Search code examples
c#fitsharpdbfit

MemberMissingException in FitSharp


When using a SUT in a DoFixture to explore its behaviour, the first call to a fixture-method succeeds but fails after invoking a SUT-method:

Screenshot

public class ConfigurationCharacterization : fitlibrary.DoFixture
{
    ConfigurationDelegator cd = new ConfigurationDelegator();
    public ConfigurationCharacterization()
    {
        mySystemUnderTest = cd;
    }


    public int AmountOfConfigsLoaded()
    {
        return cd.GetAllConfigs().Count;
    }
}

//delegates calls to the static methods of Configuration
public class ConfigurationDelegator : Configuration
{
    public new void Clear()
    {
        Configuration.Clear();
    }

    public new Configuration GetSingletonByIdentifier(string ident)
    {
        return Configuration.GetSingletonByIdentifier(ident);
    }

    public new List<Configuration> GetAllConfigs()
    {
        return Configuration.GetAllConfigs();
    }
}

Runner.exe, fit.dll and the fixture dll are all located in the same folder.


Solution

  • As has been pointed out on this github issue, GetSingletonByIdentifier returns a Configuration object that gets wrapped in a DoFixture and processes the remainder of the table. The next call of Amount of Configs Loaded then tries to access the corresponding method of the class Configuration, this doesn't exist, hence the error.