Beispiel #1
0
        public void GetTemplates_Should_Return_A_List_Of_Templates_With_Array_Sql_Populating_String()
        {
            // Arrange
            var codeTemplateArrayValues = new List <string>()
            {
                "this is a test", "to see if the lines", "join with return carriage", "###ReplaceMe###"
            };
            var replacmentChars = new List <string> {
                "###ReplaceMe###"
            };
            string name      = "test template";
            string outputDir = "c:\\test\\";

            List <SqlTemplate> testTemplate = new List <SqlTemplate>()
            {
                new SqlTemplate()
                {
                    ExistingCodeTemplateArray = codeTemplateArrayValues,
                    SqlCodeTemplateArray      = codeTemplateArrayValues,
                    Name             = name,
                    OutputDirectory  = outputDir,
                    ReplaceMentChars = replacmentChars
                }
            };

            _fileAccess.Setup(method => method.LoadJsonFile(_settings.Value.SqlTemplatesFile))
            .Returns(testTemplate);

            // Act
            var result = _processTemplate.GetTemplates().First();

            //Assert
            string answer = "this is a test\r\nto see if the lines\r\njoin with return carriage\r\n###ReplaceMe###";

            result.SqlCodeTemplate.Should().Be(answer);
            result.ExistingCodeTemplate.Should().Be(answer);
            result.Name.Should().Be(name);
            result.OutputDirectory.Should().Be(outputDir);
            result.ReplaceMentChars.First().Should().Be(replacmentChars.First());
        }