コード例 #1
0
        public void GetDefinitionWithNoResultsFoundError()
        {
            ConnectionInfo   connInfo         = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
            ServerConnection serverConnection = LiveConnectionHelper.InitLiveServerConnectionForDefinition(connInfo);

            Scripter scripter   = new Scripter(serverConnection, connInfo);
            string   objectName = "from";
            Position position   = new Position()
            {
                Line      = 1,
                Character = 14
            };
            ScriptParseInfo scriptParseInfo = new ScriptParseInfo()
            {
                IsConnected = true
            };
            Mock <IBindingContext> bindingContextMock = new Mock <IBindingContext>();
            DefinitionResult       result             = scripter.GetScript(scriptParseInfo.ParseResult, position, bindingContextMock.Object.MetadataDisplayInfoProvider, objectName, null);

            Assert.NotNull(result);
            Assert.True(result.IsErrorResult);
            Assert.Equal(SR.PeekDefinitionNoResultsError, result.Message);
        }