public void VerifyCreateLanguageWithLocalFile()
 {
     using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
     {
         ExternalLanguageOperations operations  = new ExternalLanguageOperations();
         ExternalLanguage           newLanguage = new ExternalLanguage()
         {
             Name     = "newLang",
             Contents = new List <ExternalLanguageContent>()
             {
                 new ExternalLanguageContent
                 {
                     IsLocalFile     = true,
                     PathToExtension = queryTempFile.FilePath
                 }
             }
         };
         Verify(null, (connection, lang, commandMock) =>
         {
             operations.UpdateLanguage(connection, newLanguage);
             commandMock.VerifySet(x => x.CommandText = It.Is <string>(s => s.Contains(ExternalLanguageOperations.CreateScript)));
             return(true);
         });
     }
 }
        public void VerifyRemoveContentLanguage()
        {
            ExternalLanguageOperations operations = new ExternalLanguageOperations();
            ExternalLanguage           language   = new ExternalLanguage()
            {
                Name     = "name",
                Contents = new List <ExternalLanguageContent>()
                {
                    new ExternalLanguageContent
                    {
                        IsLocalFile       = false,
                        ExtensionFileName = "filepath"
                    }
                }
            };
            ExternalLanguage newLanguage = new ExternalLanguage()
            {
                Name     = language.Name,
                Contents = new List <ExternalLanguageContent>()
            };

            Verify(language, (connection, lang, commandMock) =>
            {
                operations.UpdateLanguage(connection, newLanguage);
                commandMock.VerifySet(x => x.CommandText = It.Is <string>(
                                          s => s.Contains(ExternalLanguageOperations.AlterScript) &&
                                          s.Contains(ExternalLanguageOperations.RemoveContentScript)));
                return(true);
            });
        }
        public void VerifyDeleteLanguageWithInvalidName()
        {
            ExternalLanguageOperations operations = new ExternalLanguageOperations();
            ExternalLanguage           language   = new ExternalLanguage();

            Verify(language, (connection, lang, commandMock) =>
            {
                Assert.Throws <LanguageExtensibilityException>(() => operations.DeleteLanguage(connection, language.Name));
                return(true);
            });
        }
        public void VerifyDeleteLanguage()
        {
            ExternalLanguageOperations operations = new ExternalLanguageOperations();
            ExternalLanguage           language   = new ExternalLanguage()
            {
                Name = "name"
            };

            Verify(language, (connection, lang, commandMock) =>
            {
                operations.DeleteLanguage(connection, language.Name);
                commandMock.VerifySet(x => x.CommandText = It.Is <string>(s => s.Contains(ExternalLanguageOperations.DropScript)));
                return(true);
            });
        }