예제 #1
0
        public void ShouldReturnTheValueForName()
        {
            var properties = new MockProperties(null);
            object value = new object();
            properties.PropertiesList.Add(new MockProperty() { Name = "TestName", Value = value });

            var result = DteExtensions.GetValue<object>(properties, "TestName", null);

            Assert.AreSame(value, result);
        }
예제 #2
0
        public void ShouldReturnDefaultValueIfNameNotFound()
        {
            var properties = new MockProperties(null);
            object defaultValue = new object();
            properties.PropertiesList.Add(new MockProperty() { Name = "TestName", Value = new object() });

            var result = DteExtensions.GetValue<object>(properties, "DifferentName", defaultValue);

            Assert.AreSame(defaultValue, result);
        }
예제 #3
0
 public MockProjectItem(string pathOrName, bool isLink)
 {
     Name = Path.GetFileName(pathOrName);
     MockProperties = new MockProperties(this);
     ProjectItems = new MockProjectItems(this);
     if (isLink)
     {
         MockProperties.PropertiesList.Add(new MockProperty("FullPath", pathOrName));
         MockProperties.PropertiesList.Add(new MockProperty("IsLink", true));
         Kind = Constants.vsProjectItemKindPhysicalFile;
     }
 }
예제 #4
0
 public MockProjectItem(string pathOrName, bool isLink = false)
 {
     Name           = Path.GetFileName(pathOrName);
     MockProperties = new MockProperties(this);
     ProjectItems   = new MockProjectItems(this);
     if (isLink)
     {
         MockProperties.PropertiesList.Add(new MockProperty("FullPath", pathOrName));
         MockProperties.PropertiesList.Add(new MockProperty("IsLink", true));
         Kind = Constants.vsProjectItemKindPhysicalFile;
     }
 }
예제 #5
0
 public MockProject()
 {
     Properties = new MockProperties(this);
     FullName = string.Format(@"c:\mockProjectPath\{0}\{0}.csproj", random.Next());
     ProjectItems = new MockProjectItems(this);
 }
예제 #6
0
 public MockProject()
 {
     Properties   = new MockProperties(this);
     FullName     = string.Format(@"c:\mockProjectPath\{0}\{0}.csproj", Random.Next());
     ProjectItems = new MockProjectItems(this);
 }