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

Code before:
                                }

                                // Create a vector set with known parameters
                                var res = db.Execute("VADD", GenerateVADDOptions(fooKey, quantizer, reduceValueToUse, ef, numLinks, vectorValues.ToArray(), [0, 0, 0, 0]));
                                ClassicAssert.AreEqual(1, (int)res);

                                string expectedEf = ef == 0 ? "200" : ef.ToString();
                                string expectedNumLinks = numLinks == 0 ? "16" : numLinks.ToString();

                                // Get VINFO - should return an array of 12 elements (6 key-value pairs)
                                var vinfoRes = (RedisValue[])db.Execute("VINFO", [fooKey]);
                                ClassicAssert.AreEqual(12, vinfoRes.Length);
                                var values = BuildDictionaryFromResponse(vinfoRes);
                                ClassicAssert.AreEqual(values["quant-type"], expectedQuantType);
                                ClassicAssert.AreEqual(values["input-vector-dimensions"], vectorDim.ToString());
                                ClassicAssert.AreEqual(values["reduced-dimensions"], reduceValueToUse.ToString());
                                ClassicAssert.AreEqual(values["build-exploration-factor"], expectedEf);
                                ClassicAssert.AreEqual(values["num-links"], expectedNumLinks);
                                // TODO: Update once DiskANN exposes card()
                                ClassicAssert.AreEqual(values["size"], "0");

                                // Modify first value for second add (change from "1.0" to "2.0")
                                vectorValues[2] = "2.0";

                                // Add another element and try again
                                res = db.Execute("VADD", GenerateVADDOptions(fooKey, quantizer, reduceValueToUse, ef, numLinks, vectorValues.ToArray(), [0, 0, 0, 0]));
                                ClassicAssert.AreEqual(1, (int)res);

                                vinfoRes = (RedisValue[])db.Execute(command: "VINFO", [fooKey]);
                                ClassicAssert.AreEqual(12, vinfoRes.Length);
                                values = BuildDictionaryFromResponse(vinfoRes);
                                ClassicAssert.AreEqual(values["quant-type"], expectedQuantType);
                                ClassicAssert.AreEqual(values["input-vector-dimensions"], vectorDim.ToString());
                                ClassicAssert.AreEqual(values["reduced-dimensions"], reduceValueToUse.ToString());
                                ClassicAssert.AreEqual(values["build-exploration-factor"], expectedEf);
                                ClassicAssert.AreEqual(values["num-links"], expectedNumLinks);
                                // TODO: Update once DiskANN exposes card()
                                ClassicAssert.AreEqual(values["size"], "0");

                                // Delete vector set
                                db.KeyDelete(fooKey);
                            }
                        }
                    }
                }
            }

            static object[] GenerateVADDOptions(string key, string quantizer, int reduce, int buildExplorationFactor, int numLinks, object[] values, byte[] elementId)
            {
                if (quantizer == "XPREQ8")
                {

Review comment (bug):
I suspect you wanted this element to be `[1, 0, 0, 0]`, otherwise `VADD` doing an update instead of add.  Can't tell it now, but in the future the size result would be wrong.

Code after:
                                testCnt++;
                                string fooKey = $"foo:{testCnt}";

                                // Generate vector values based on dimension
                                var vectorValues = new List<object> { "VALUES", vectorDim.ToString() };
                                for (int i = 1; i <= vectorDim; i++)
                                {
                                    vectorValues.Add($"{i}.0");
                                }

                                // Create a vector set with known parameters
                                var res = db.Execute("VADD", GenerateVADDOptions(fooKey, quantizer, reduceValueToUse, ef, numLinks, vectorValues.ToArray(), [0, 0, 0, 0]));
                                ClassicAssert.AreEqual(1, (int)res);

                                string expectedEf = ef == 0 ? "200" : ef.ToString();
                                string expectedNumLinks = numLinks == 0 ? "16" : numLinks.ToString();

                                // Get VINFO - should return an array of 12 elements (6 key-value pairs)
                                var vinfoRes = (RedisValue[])db.Execute("VINFO", [fooKey]);
                                ClassicAssert.AreEqual(12, vinfoRes.Length);
                                var values = BuildDictionaryFromResponse(vinfoRes);
                                ClassicAssert.AreEqual(values["quant-type"], expectedQuantType);
                                ClassicAssert.AreEqual(values["input-vector-dimensions"], vectorDim.ToString());
                                ClassicAssert.AreEqual(values["reduced-dimensions"], reduceValueToUse.ToString());
                                ClassicAssert.AreEqual(values["build-exploration-factor"], expectedEf);
                                ClassicAssert.AreEqual(values["num-links"], expectedNumLinks);
                                // TODO: Update once DiskANN exposes card()
                                ClassicAssert.AreEqual(values["size"], "0");

                                // Modify first value for second add (change from "1.0" to "2.0")
                                vectorValues[2] = "2.0";

                                // Add another element and try again
                                res = db.Execute("VADD", GenerateVADDOptions(fooKey, quantizer, reduceValueToUse, ef, numLinks, vectorValues.ToArray(), [0, 0, 0, 1]));
                                ClassicAssert.AreEqual(1, (int)res);

                                vinfoRes = (RedisValue[])db.Execute(command: "VINFO", [fooKey]);
                                ClassicAssert.AreEqual(12, vinfoRes.Length);
                                values = BuildDictionaryFromResponse(vinfoRes);
                                ClassicAssert.AreEqual(values["quant-type"], expectedQuantType);
                                ClassicAssert.AreEqual(values["input-vector-dimensions"], vectorDim.ToString());
                                ClassicAssert.AreEqual(values["reduced-dimensions"], reduceValueToUse.ToString());
                                ClassicAssert.AreEqual(values["build-exploration-factor"], expectedEf);
                                ClassicAssert.AreEqual(values["num-links"], expectedNumLinks);
                                // TODO: Update once DiskANN exposes card()
                                ClassicAssert.AreEqual(values["size"], "0");

                                // Delete vector set
                                db.KeyDelete(fooKey);
                            }
                        }