using FsCheck; using FsCheck.Xunit; using SolutionCleanupTool.Models; using System; using System.Collections.Generic; using System.IO; namespace SolutionCleanupTool.Tests { /// /// Base class for property-based tests with common generators and utilities /// public abstract class PropertyTestBase { /// /// Configuration for property-based tests - minimum 100 iterations as per requirements /// protected static readonly Configuration TestConfig = new Configuration { MaxNbOfTest = 100, StartSize = 1, EndSize = 100 }; /// /// Generator for valid project GUIDs /// public static Arbitrary ProjectGuidGenerator() { return Arb.Generate().ToArbitrary(); } /// /// Generator for project references /// public static Arbitrary ProjectReferenceGenerator() { return (from name in Arb.Generate() from path in Arb.Generate() from guid in Arb.Generate() from typeGuid in Arb.Generate() from exists in Arb.Generate() select new ProjectReference { Name = name.Get, RelativePath = path.Get, AbsolutePath = Path.Combine("C:\\TestSolution", path.Get), ProjectGuid = guid, ProjectTypeGuid = typeGuid.Get, Exists = exists }).ToArbitrary(); } /// /// Generator for solution models /// public static Arbitrary SolutionModelGenerator() { return (from path in Arb.Generate() from projects in Arb.Generate>() select new SolutionModel { FilePath = path.Get + ".sln", Projects = projects ?? new List() }).ToArbitrary(); } } }