Example #1
0
        public void ArrayIndex()
        {
            IDkmClrFullNameProvider fullNameProvider = new CSharpFormatter();
            var inspectionContext = CreateDkmInspectionContext();

            Assert.Equal(
                "[]",
                fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new string[0])
                );
            Assert.Equal(
                "[]",
                fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "" })
                );
            Assert.Equal(
                "[ ]",
                fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { " " })
                );
            Assert.Equal(
                "[1]",
                fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "1" })
                );
            Assert.Equal(
                "[[], 2, 3]",
                fullNameProvider.GetClrArrayIndexExpression(
                    inspectionContext,
                    new[] { "[]", "2", "3" }
                    )
                );
            Assert.Equal(
                "[, , ]",
                fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "", "", "" })
                );
        }