예제 #1
0
        public void ShouldLogErrorIfNoCodeGenerationStrategy()
        {
            MockVsRDT rdt;
            TestableCodeGenerationService target = CreateCodeGenerator(ItemPath, out rdt) as TestableCodeGenerationService;

            Assert.AreEqual <int>(0, target.LogEntries.Count);
            target.GenerateArtifact(new NoStrategyArtifactLink(ItemPath));

            Assert.AreEqual <int>(1, target.LogEntries.Count);
            foreach (LogEntry entry in target.LogEntries)
            {
                Assert.AreEqual <string>("No CodeGenerationStrategyAttribute found on IArtifactLink object.", entry.Message);
            }
        }
예제 #2
0
        public void TestValidateDelete()
        {
            MockServiceProvider serviceProvider = new MockServiceProvider();
            MockVSHierarchy     root            = new MockVSHierarchy();
            MockVsSolution      solution        = new MockVsSolution(root);
            MockVSHierarchy     project         = new MockVSHierarchy("Project1.project");

            root.AddProject(project);
            serviceProvider.AddService(typeof(SVsSolution), solution);
            TestableCodeGenerationService target = new TestableCodeGenerationService(serviceProvider);
            MyArtifactLink validLink             = new MyArtifactLink(project.GUID, "item1.cs");
            HierarchyNode  node = target.ValidateDelete(validLink);

            Assert.IsNull(node);
            Assert.AreEqual <int>(0, target.LogEntries.Count);
            project.AddChild("item1.cs");
            node = target.ValidateDelete(validLink);
            Assert.IsNotNull(node);
            Assert.AreEqual <int>(1, target.LogEntries.Count);
        }
		public void TestValidateEmptyRename()
		{
			MockServiceProvider serviceProvider = new MockServiceProvider();
			MockVSHierarchy root = new MockVSHierarchy();
			MockVsSolution solution = new MockVsSolution(root);
			MockVSHierarchy project = new MockVSHierarchy("Project1.project");
			root.AddProject(project);
			serviceProvider.AddService(typeof(SVsSolution), solution);
			TestableCodeGenerationService target = new TestableCodeGenerationService(serviceProvider);
			string oldName = "item1";
			string newName = "";
			MyArtifactLink validLink = new MyArtifactLink(project.GUID, oldName + ".cs");
			HierarchyNode node = target.ValidateRename(validLink, newName, oldName);

			Assert.IsNull(node);
			project.AddChild(oldName + ".cs");
			node = target.ValidateRename(validLink, oldName, oldName);
			Assert.IsNull(node);
			Assert.AreEqual<int>(0, target.LogEntries.Count);
			node = target.ValidateRename(validLink, newName, oldName);
			Assert.IsNotNull(node);
			Assert.AreEqual<int>(1, target.LogEntries.Count);
		}