コード例 #1
0
        public void DeleteUserCodeTemplateCommandExecute_ShouldDeleteUserCodeTemplate()
        {
            //Arange
            string        currentFilePath   = AppDomain.CurrentDomain.BaseDirectory;
            string        amlMethodFilePath = Path.Combine(currentFilePath, @"Code\TestData\MethodAml\ReturnNullMethodAml.xml");
            string        key        = "ReturnNullMethodAml";
            XmlMethodInfo methodInfo = new XmlMethodInfo()
            {
                Path = amlMethodFilePath
            };

            KeyValuePair <string, XmlMethodInfo> userCodeTemplate = new KeyValuePair <string, XmlMethodInfo>(key, methodInfo);

            this.globalConfiguration.GetUserCodeTemplatesPaths().Returns(new List <string>()
            {
                amlMethodFilePath
            });

            //Act
            this.createMethodViewModel.DeleteUserCodeTemplateCommand.Execute(userCodeTemplate);

            //Assert
            this.globalConfiguration.Received().RemoveUserCodeTemplatePath(methodInfo.Path);
            Assert.AreEqual(1, this.createMethodViewModel.UserCodeTemplates.Count);
        }
コード例 #2
0
        public void LoadMethod_ShouldReturnNull()
        {
            //Arange
            XmlMethodLoader xmlMethodLoader = new XmlMethodLoader();

            //Act
            XmlMethodInfo loadMethodResult = xmlMethodLoader.LoadMethod("");

            //Assert
            Assert.IsNull(loadMethodResult);
        }
コード例 #3
0
        public void LoadMethod_ShouldReturnExpected()
        {
            //Arange
            var             currentPath     = System.AppDomain.CurrentDomain.BaseDirectory;
            var             methodAmlPath   = Path.Combine(currentPath, @"Code\TestData\MethodAml\ReturnNullMethodAml.xml");
            XmlMethodLoader xmlMethodLoader = new XmlMethodLoader();

            //Act
            XmlMethodInfo loadMethodResult = xmlMethodLoader.LoadMethod(methodAmlPath);

            //Assert
            Assert.IsNotNull(loadMethodResult);
            Assert.AreEqual("\r\nreturn null;", loadMethodResult.Code);
            Assert.AreEqual("ReturnNullMethodAml", loadMethodResult.MethodName);
            Assert.AreEqual("C#", loadMethodResult.MethodType);
            Assert.AreEqual(methodAmlPath, loadMethodResult.Path);
        }