VSharp-team / VSharp

Symbolic execution engine for .NET Core
Apache License 2.0
50 stars 32 forks source link

V#.Runner could not find public method of nested public static type #197

Open MchKosticyn opened 1 year ago

MchKosticyn commented 1 year ago
public static class Linq
{
    private enum EventType
    {
        Save,
        Change
    }
    private record Event(int UserId, EventType Type, string Delta);
    public interface ISaver<in T>
    {
        bool Save(IEnumerable<T> deltas);
    }
    public static class AutoSaveService
    {
        public static bool AutoSave(int userId, int autoSaveThreshold, ISaver<string> saver)
        {
            var events = new List<Event>
            {
                new Event(1, EventType.Change, "gcctaca"),
                new Event(1, EventType.Change, "ctccagg"),
                new Event(1, EventType.Save, ""),
                new Event(1, EventType.Change, "gatagtc"),
                new Event(2, EventType.Change, "agcggaa"),
            };

            var notSavedChanges =
                from e in events where e.UserId == userId select e;
            notSavedChanges = notSavedChanges.TakeWhile(e => e.Type == EventType.Change);

            if (notSavedChanges.Count() > autoSaveThreshold)
            {
                return saver.Save(from e in notSavedChanges select e.Delta);
            }

            return false;
        }
    }
}

StackTrace:

Unhandled exception. System.ArgumentException: I've not found any public method or constructor of class Linq
   at VSharp.TestGenerator.Cover(Type type, Int32 timeout, String outputDirectory, Boolean renderTests, SearchStrategy searchStrategy, Verbosity verbosity)
   at VSharp.TestGenerator.CoverAndRun(Type type, Int32 timeout, String outputDirectory, Boolean renderTests, SearchStrategy searchStrategy, Verbosity verbosity)
   at Program.Main() in /Users/michael/Documents/Work/ConsoleApp1/ConsoleApp1/Program.cs:line 53