Пример #1
0
        public void CreatePartialCodeInfo_ShouldReturnEmptyCode()
        {
            //Arrange
            var currentPath = System.AppDomain.CurrentDomain.BaseDirectory;

            projectManager.MethodConfigPath.Returns(Path.Combine(currentPath, "TestData\\method-config.xml"));
            projectManager.ServerMethodFolderPath.Returns(Path.Combine(currentPath, "Code\\TestData\\"));
            projectManager.MethodName.Returns(Path.Combine(currentPath, "TestMethod"));
            projectManager.SelectedFolderPath.Returns(Path.Combine(currentPath, "Code\\TestData\\CreatePartialCodeInfo"));
            projectManager.MethodName.Returns("CreatePartialCodeInfo");
            projectManager.DefaultCodeTemplatesPath.Returns(Path.Combine(currentPath, "TestData"));
            projectManager.MethodPath.Returns(Path.Combine(currentPath, "Code\\TestData\\CreatePartialCodeInfo\\MethodCode.txt"));
            var fileName   = "TestFile";
            var methodInfo = new MethodInfo
            {
                MethodLanguage = @"C#",
                TemplateName   = "CSharp",
                EventData      = EventSpecificData.None,
            };

            //Act
            var expected = codeProvider.CreatePartialCodeInfo(methodInfo, fileName, false);

            //Assert
            Assert.AreEqual(expected.Path, @"CreatePartialCodeInfo\TestFile");
            Assert.AreEqual(expected.Code, File.ReadAllText(Path.Combine(currentPath, "Code\\TestData\\CreatePartialCodeInfo\\ExpectedEmptyCode.txt")));
        }