VSharp icon indicating copy to clipboard operation
VSharp copied to clipboard

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

Open MchKosticyn opened this issue 3 years ago • 0 comments

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

MchKosticyn avatar Dec 15 '22 11:12 MchKosticyn