public void RegularSamplesLayOnGrid() { int samplesCount = 16; int gridSize = (int)Math.Sqrt(samplesCount); List <Vector2> samples = Vec2Sampling.Regular(samplesCount); List <float> xCoords = samples.GroupBy(sample => sample.X) .Select(group => group.First().X) .ToList(); List <float> yCoords = samples.GroupBy(sample => sample.Y) .Select(group => group.First().Y) .ToList(); samples.Should() .OnlyHaveUniqueItems() .And .HaveCount(samplesCount); xCoords.Should() .OnlyHaveUniqueItems() .And .HaveCount(gridSize); yCoords.Should() .OnlyHaveUniqueItems() .And .HaveCount(gridSize); }
public void RegularGeneratingFunctionReturnsRequiredSizedSampleList() { const int samplesCount = 10; List <Vector2> samples = Vec2Sampling.Regular(samplesCount); samples.Should().HaveCount(samplesCount); }