Repository: microsoft/garnet
File: test/Garnet.test/DiskANN/DiskANNGridTests.cs (C#)

Code before:
using StackExchange.Redis;

namespace Garnet.test.DiskANN
{
    [TestFixture]
    class DiskANNGridTests
    {
        GarnetServer server;

        [SetUp]
        public void Setup()
        {
            TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
            server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir);
            server.Start();
        }

        [TearDown]
        public void TearDown()
        {
            server.Dispose();
            TestUtils.DeleteDirectory(TestUtils.MethodTestDir);
        }

        [Test]
        [TestCase(100, 1, "NOQUANT")]
        [TestCase(10, 2, "NOQUANT")]
        [TestCase(3, 7, "NOQUANT")]
        [TestCase(4, 5, "NOQUANT")]
        public void SearchVectorsInGrid(int gridSize, int dimension, string quantType)
        {
            using var redis = ConnectionMultiplexer.Connect(TestUtils.GetConfig());
            var db = redis.GetDatabase(0);

            var key = $"gridset_{gridSize}_{dimension}_{quantType}";
            var addedGridVectors = AddGridVectors(db, key, dimension, gridSize, quantType);

            // VSIM using existing elements
            var vsimArgs = new object[5];
            vsimArgs[0] = key;
            vsimArgs[1] = "ELE";
            vsimArgs[3] = "COUNT";
            vsimArgs[4] = "25";
            foreach (var addedGridVector in addedGridVectors.Values)
            {
                vsimArgs[2] = addedGridVector.IdBytes;
                var res = db.Execute("VSIM", vsimArgs);
                ClassicAssert.AreEqual(25, res.Length);
                var vsimIds = GetVectorIdsForVsimResults((RedisResult[])res);
                var expectedNN = BruteForceNearestNeighbors(addedGridVectors, addedGridVector.Vector, 25);
                var intersectionCount = CalculateDistanceCountsIntersection(addedGridVectors, addedGridVector.Vector, expectedNN, vsimIds);

Review comment (suggestion):
nit: I'd prefer using `VectorQuantType.NoQuant`, `Bin`, `Q8`, etc.  Makes it easier to confirm we've tested all quantizers.

Code after:
using NUnit.Framework.Legacy;
using StackExchange.Redis;

namespace Garnet.test.DiskANN
{
    [TestFixture]
    public class DiskANNGridTests
    {
        private GarnetServer server;

        [SetUp]
        public void Setup()
        {
            TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
            server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir);
            server.Start();
        }

        [TearDown]
        public void TearDown()
        {
            server.Dispose();
            TestUtils.DeleteDirectory(TestUtils.MethodTestDir);
        }

        [Test]
        [TestCase(100, 1, VectorQuantType.XPreQ8)]
        [TestCase(10, 2, VectorQuantType.XPreQ8)]
        [TestCase(3, 7, VectorQuantType.XPreQ8)]
        [TestCase(4, 5, VectorQuantType.XPreQ8)]
        public void SearchVectorsInGrid(int gridSize, int dimension, VectorQuantType quantType)
        {
            string quantTypeStr = quantType switch
            {
                VectorQuantType.NoQuant => "NOQUANT",
                VectorQuantType.Bin => "BIN",
                VectorQuantType.Q8 => "Q8",
                VectorQuantType.XPreQ8 => "XPREQ8",
                _ => throw new ArgumentException("Invalid quant type")
            };

            using var redis = ConnectionMultiplexer.Connect(TestUtils.GetConfig());
            var db = redis.GetDatabase(0);

            var key = $"gridset_{gridSize}_{dimension}_{quantTypeStr}";
            var addedGridVectors = AddGridVectors(db, key, dimension, gridSize, quantTypeStr);

            // VSIM using existing elements
            var vsimArgs = new object[5];
            vsimArgs[0] = key;
            vsimArgs[1] = "ELE";