22 changed files with 1315 additions and 409 deletions
@ -1,77 +1,77 @@
@@ -1,77 +1,77 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.SharpDevelop.Project.Commands; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class ViewInBrowser : AbstractMenuCommand |
||||
{ |
||||
public override void Run() |
||||
{ |
||||
var node = ProjectBrowserPad.Instance.SelectedNode as FileNode; |
||||
if (node == null) { |
||||
return; |
||||
} |
||||
|
||||
var project = ProjectService.CurrentProject as CompilableProject; |
||||
if (project == null) { |
||||
return; |
||||
} |
||||
|
||||
if (!project.IsWebProject) { |
||||
MessageService.ShowError("${res:ProjectComponent.ContextMenu.NotAWebProject}"); |
||||
return; |
||||
} |
||||
|
||||
if (!WebProjectService.IsIISOrIISExpressInstalled) { |
||||
MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.IISNotFound}"); |
||||
return; |
||||
} |
||||
|
||||
string fileName = node.FileName; |
||||
|
||||
// // set project options
|
||||
// project.StartAction = StartAction.StartURL;
|
||||
// string directoryName = Path.GetDirectoryName(project.FileName) + "\\";
|
||||
// project.StartUrl = fileName.Replace(directoryName, "/").Replace("\\", "/");
|
||||
|
||||
// set web server options
|
||||
string projectName = project.Name; |
||||
WebProjectOptions existingOptions = WebProjectsOptions.Instance.GetWebProjectOptions(projectName); |
||||
|
||||
var options = new WebProjectOptions { |
||||
Data = new WebProjectDebugData { |
||||
WebServer = WebProjectService.IsIISExpressInstalled ? WebServer.IISExpress : WebServer.IIS, |
||||
Port = (existingOptions != null && existingOptions.Data != null) ? existingOptions.Data.Port : "8080", //TODO: port collision detection
|
||||
ProjectUrl = string.Format("{0}/{1}", WebBehavior.LocalHost, project.Name) |
||||
}, |
||||
ProjectName = projectName |
||||
}; |
||||
|
||||
if (options.Data.WebServer == WebServer.IISExpress) { |
||||
options.Data.ProjectUrl = string.Format( |
||||
@"{0}:{1}/{2}", WebBehavior.LocalHost, options.Data.Port, projectName); |
||||
} |
||||
|
||||
WebProjectsOptions.Instance.SetWebProjectOptions(projectName, options); |
||||
|
||||
// create virtual directory
|
||||
string error = WebProjectService.CreateVirtualDirectory( |
||||
options.Data.WebServer, |
||||
projectName, |
||||
Path.GetDirectoryName(ProjectService.CurrentProject.FileName)); |
||||
LoggingService.Info(error ?? string.Empty); |
||||
|
||||
// RunProject
|
||||
new RunProject().Run(); |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Linq;
|
||||
//
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Gui.OptionPanels;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using ICSharpCode.SharpDevelop.Project.Commands;
|
||||
//
|
||||
//namespace ICSharpCode.AspNet.Mvc
|
||||
//{
|
||||
// public class ViewInBrowser : AbstractMenuCommand
|
||||
// {
|
||||
// public override void Run()
|
||||
// {
|
||||
// var node = ProjectBrowserPad.Instance.SelectedNode as FileNode;
|
||||
// if (node == null) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// var project = ProjectService.CurrentProject as CompilableProject;
|
||||
// if (project == null) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (!project.IsWebProject) {
|
||||
// MessageService.ShowError("${res:ProjectComponent.ContextMenu.NotAWebProject}");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (!WebProjectService.IsIISOrIISExpressInstalled) {
|
||||
// MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.IISNotFound}");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// string fileName = node.FileName;
|
||||
//
|
||||
//// // set project options
|
||||
//// project.StartAction = StartAction.StartURL;
|
||||
//// string directoryName = Path.GetDirectoryName(project.FileName) + "\\";
|
||||
//// project.StartUrl = fileName.Replace(directoryName, "/").Replace("\\", "/");
|
||||
//
|
||||
// // set web server options
|
||||
// string projectName = project.Name;
|
||||
// WebProjectOptions existingOptions = WebProjectsOptions.Instance.GetWebProjectOptions(projectName);
|
||||
//
|
||||
// var options = new WebProjectOptions {
|
||||
// Data = new WebProjectDebugData {
|
||||
// WebServer = WebProjectService.IsIISExpressInstalled ? WebServer.IISExpress : WebServer.IIS,
|
||||
// Port = (existingOptions != null && existingOptions.Data != null) ? existingOptions.Data.Port : "8080", //TODO: port collision detection
|
||||
// ProjectUrl = string.Format("{0}/{1}", WebBehavior.LocalHost, project.Name)
|
||||
// },
|
||||
// ProjectName = projectName
|
||||
// };
|
||||
//
|
||||
// if (options.Data.WebServer == WebServer.IISExpress) {
|
||||
// options.Data.ProjectUrl = string.Format(
|
||||
// @"{0}:{1}/{2}", WebBehavior.LocalHost, options.Data.Port, projectName);
|
||||
// }
|
||||
//
|
||||
// WebProjectsOptions.Instance.SetWebProjectOptions(projectName, options);
|
||||
//
|
||||
// // create virtual directory
|
||||
// string error = WebProjectService.CreateVirtualDirectory(
|
||||
// options.Data.WebServer,
|
||||
// projectName,
|
||||
// Path.GetDirectoryName(ProjectService.CurrentProject.FileName));
|
||||
// LoggingService.Info(error ?? string.Empty);
|
||||
//
|
||||
// // RunProject
|
||||
// new RunProject().Run();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using System.Xml.Linq; |
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class VisualStudioProjectExtension |
||||
{ |
||||
public static readonly string ProjectExtensionName = "VisualStudio"; |
||||
public static readonly string FlavorPropertiesName = "FlavorProperties"; |
||||
|
||||
WebProjectProperties webProjectProperties; |
||||
MSBuildBasedProject msbuildProject; |
||||
|
||||
public VisualStudioProjectExtension(WebProjectProperties properties) |
||||
{ |
||||
this.webProjectProperties = properties; |
||||
} |
||||
|
||||
public VisualStudioProjectExtension(MSBuildBasedProject msbuildProject) |
||||
{ |
||||
this.msbuildProject = msbuildProject; |
||||
} |
||||
|
||||
public string Name { |
||||
get { return ProjectExtensionName; } |
||||
} |
||||
|
||||
public XElement ToXElement() |
||||
{ |
||||
var flavorProperties = new XElement(FlavorPropertiesName); |
||||
flavorProperties.SetAttributeValue("GUID", "{349C5851-65DF-11DA-9384-00065B846F21}"); |
||||
flavorProperties.Add(webProjectProperties.ToXElement()); |
||||
return flavorProperties; |
||||
} |
||||
|
||||
public static bool ProjectContainsExtension(MSBuildBasedProject msbuildProject) |
||||
{ |
||||
return msbuildProject.ContainsProjectExtension(ProjectExtensionName); |
||||
} |
||||
|
||||
public WebProjectProperties GetWebProjectProperties() |
||||
{ |
||||
XElement element = msbuildProject.LoadProjectExtensions(ProjectExtensionName); |
||||
return new WebProjectProperties(element.Descendants().First()); |
||||
} |
||||
|
||||
public void Save(MSBuildBasedProject msbuildProject) |
||||
{ |
||||
msbuildProject.SaveProjectExtensions(ProjectExtensionName, ToXElement()); |
||||
} |
||||
|
||||
public bool ContainsWebProjectProperties() |
||||
{ |
||||
XElement element = msbuildProject.LoadProjectExtensions(ProjectExtensionName); |
||||
return element.Element("WebProjectProperties") != null; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class WebProject |
||||
{ |
||||
public static readonly WebProjectProperties DefaultProperties = new WebProjectProperties |
||||
{ |
||||
DevelopmentServerPort = 8080, |
||||
DevelopmentServerVPath = "/" |
||||
}; |
||||
|
||||
MSBuildBasedProject msbuildProject; |
||||
|
||||
public WebProject(MSBuildBasedProject msbuildProject) |
||||
{ |
||||
this.msbuildProject = msbuildProject; |
||||
} |
||||
|
||||
public bool HasWebProjectProperties() |
||||
{ |
||||
if (VisualStudioProjectExtension.ProjectContainsExtension(msbuildProject)) { |
||||
var projectExtension = new VisualStudioProjectExtension(msbuildProject); |
||||
return projectExtension.ContainsWebProjectProperties(); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public WebProjectProperties GetWebProjectProperties() |
||||
{ |
||||
if (HasWebProjectProperties()) { |
||||
var projectExtension = new VisualStudioProjectExtension(msbuildProject); |
||||
WebProjectProperties properties = projectExtension.GetWebProjectProperties(); |
||||
properties.UseIISExpress = UseIISExpress; |
||||
return properties; |
||||
} |
||||
return DefaultProperties; |
||||
} |
||||
|
||||
public bool UseIISExpress |
||||
{ |
||||
get { return GetUseIISExpress(); } |
||||
} |
||||
|
||||
bool GetUseIISExpress() |
||||
{ |
||||
string value = GetMSBuildProperty("UseIISExpress"); |
||||
bool result = false; |
||||
Boolean.TryParse(value, out result); |
||||
return result; |
||||
} |
||||
|
||||
string GetMSBuildProperty(string propertyName) |
||||
{ |
||||
string value = msbuildProject.GetEvaluatedProperty(propertyName); |
||||
if (value != null) { |
||||
return value; |
||||
} |
||||
return String.Empty; |
||||
} |
||||
|
||||
public void UpdateWebProjectProperties(WebProjectProperties properties) |
||||
{ |
||||
var projectExtension = new VisualStudioProjectExtension(properties); |
||||
projectExtension.Save(msbuildProject); |
||||
SetMSBuildProperty("UseIISExpress", properties.UseIISExpress); |
||||
} |
||||
|
||||
void SetMSBuildProperty(string propertyName, bool value) |
||||
{ |
||||
msbuildProject.SetProperty(propertyName, value.ToString()); |
||||
} |
||||
} |
||||
} |
@ -1,71 +0,0 @@
@@ -1,71 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public sealed class WebProjectsOptions |
||||
{ |
||||
private WebProjectsOptions() { } |
||||
|
||||
private static readonly WebProjectsOptions _Instance = new WebProjectsOptions(); |
||||
|
||||
private List<WebProjectOptions> options = new List<WebProjectOptions>(); |
||||
|
||||
public WebProjectOptions GetWebProjectOptions(string projectName) { |
||||
return options.Find(o => o.ProjectName == projectName); |
||||
} |
||||
|
||||
public void SetWebProjectOptions(string projectName, WebProjectOptions data) |
||||
{ |
||||
var d = GetWebProjectOptions(projectName); |
||||
if (d == null) |
||||
{ |
||||
if (data == null) |
||||
data = new WebProjectOptions() { ProjectName = projectName }; |
||||
|
||||
options.Add(data); |
||||
} |
||||
else |
||||
{ |
||||
int index = options.IndexOf(d); |
||||
options[index] = data; |
||||
} |
||||
} |
||||
|
||||
public static WebProjectsOptions Instance { |
||||
get { |
||||
return _Instance; |
||||
} |
||||
} |
||||
} |
||||
|
||||
[Serializable] |
||||
public class WebProjectOptions |
||||
{ |
||||
[DefaultValue(null)] |
||||
public string ProjectName { get; set; } |
||||
|
||||
[DefaultValue(null)] |
||||
public WebProjectDebugData Data { get; set; } |
||||
} |
||||
|
||||
[Serializable] |
||||
public class WebProjectDebugData |
||||
{ |
||||
[DefaultValue(null)] |
||||
public string ProjectUrl { get; set; } |
||||
|
||||
[DefaultValue("8080")] |
||||
public string Port { get; set; } |
||||
|
||||
[DefaultValue(WebServer.None)] |
||||
public WebServer WebServer { get; set; } |
||||
} |
||||
} |
@ -0,0 +1,148 @@
@@ -0,0 +1,148 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Xml; |
||||
using System.Xml.Linq; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class WebProjectProperties |
||||
{ |
||||
public WebProjectProperties() |
||||
{ |
||||
this.CustomServerUrl = String.Empty; |
||||
this.DevelopmentServerVPath = String.Empty; |
||||
this.IISUrl = String.Empty; |
||||
} |
||||
|
||||
public WebProjectProperties(XElement element) |
||||
{ |
||||
Load(element); |
||||
} |
||||
|
||||
void Load(XElement element) |
||||
{ |
||||
AutoAssignPort = GetChildElementBoolean("AutoAssignPort", element); |
||||
CustomServerUrl = GetChildElementString("CustomServerUrl", element); |
||||
DevelopmentServerPort = GetChildElementInteger("DevelopmentServerPort", element); |
||||
DevelopmentServerVPath = GetChildElementString("DevelopmentServerVPath", element); |
||||
IISUrl = GetChildElementString("IISUrl", element); |
||||
NTLMAuthentication = GetChildElementBoolean("NTLMAuthentication", element); |
||||
SaveServerSettingsInUserFile = GetChildElementBoolean("SaveServerSettingsInUserFile", element); |
||||
UseCustomServer = GetChildElementBoolean("UseCustomServer", element); |
||||
UseIIS = GetChildElementBoolean("UseIIS", element); |
||||
} |
||||
|
||||
string GetChildElementString(string name, XElement element) |
||||
{ |
||||
XElement childElement = element.Element(name); |
||||
if (childElement != null) { |
||||
return childElement.Value; |
||||
} |
||||
return String.Empty; |
||||
} |
||||
|
||||
int GetChildElementInteger(string name, XElement element) |
||||
{ |
||||
string value = GetChildElementString(name, element); |
||||
int result = 0; |
||||
Int32.TryParse(value, out result); |
||||
return result; |
||||
} |
||||
|
||||
bool GetChildElementBoolean(string name, XElement element) |
||||
{ |
||||
string value = GetChildElementString(name, element); |
||||
bool result = false; |
||||
Boolean.TryParse(value, out result); |
||||
return result; |
||||
} |
||||
|
||||
public override bool Equals(object obj) |
||||
{ |
||||
var properties = obj as WebProjectProperties; |
||||
if (properties != null) { |
||||
return Equals(properties); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
bool Equals(WebProjectProperties properties) |
||||
{ |
||||
return |
||||
(AutoAssignPort == properties.AutoAssignPort) && |
||||
(UseIIS == properties.UseIIS) && |
||||
(DevelopmentServerVPath == properties.DevelopmentServerVPath) && |
||||
(DevelopmentServerPort == properties.DevelopmentServerPort) && |
||||
(CustomServerUrl == properties.CustomServerUrl) && |
||||
(UseCustomServer == properties.UseCustomServer) && |
||||
(SaveServerSettingsInUserFile == properties.SaveServerSettingsInUserFile) && |
||||
(UseIISExpress == properties.UseIISExpress) && |
||||
(NTLMAuthentication == properties.NTLMAuthentication) && |
||||
(IISUrl == properties.IISUrl); |
||||
} |
||||
|
||||
public override int GetHashCode() |
||||
{ |
||||
return base.GetHashCode(); |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
return String.Format( |
||||
"[WebProjectProperties IISUrl=\"{0}\", UseIISExpress={1}, UseIIS={2}, SaveServerSettingsInUserFile={3}]", |
||||
IISUrl, |
||||
UseIISExpress, |
||||
UseIIS, |
||||
SaveServerSettingsInUserFile); |
||||
} |
||||
|
||||
public bool AutoAssignPort { get; set; } |
||||
public string DevelopmentServerVPath { get; set; } |
||||
public int DevelopmentServerPort { get; set; } |
||||
|
||||
public bool NTLMAuthentication { get; set; } |
||||
|
||||
public bool UseIIS { get; set; } |
||||
public string IISUrl { get; set; } |
||||
public bool UseIISExpress { get; set; } |
||||
|
||||
public bool SaveServerSettingsInUserFile { get; set; } |
||||
|
||||
public bool UseCustomServer { get; set; } |
||||
public string CustomServerUrl { get; set; } |
||||
|
||||
public XElement ToXElement() |
||||
{ |
||||
return new XElement( |
||||
"WebProjectProperties", |
||||
CreateBooleanXElement("UseIIS", UseIIS), |
||||
CreateBooleanXElement("AutoAssignPort", AutoAssignPort), |
||||
new XElement("DevelopmentServerPort", DevelopmentServerPort), |
||||
new XElement("DevelopmentServerVPath", DevelopmentServerVPath), |
||||
new XElement("IISUrl", IISUrl), |
||||
CreateBooleanXElement("NTLMAuthentication", NTLMAuthentication), |
||||
CreateBooleanXElement("UseCustomServer", UseCustomServer), |
||||
new XElement("CustomServerUrl", CustomServerUrl), |
||||
CreateBooleanXElement("SaveServerSettingsInUserFile", SaveServerSettingsInUserFile)); |
||||
} |
||||
|
||||
XElement CreateBooleanXElement(string name, bool value) |
||||
{ |
||||
return new XElement(name, value.ToString()); |
||||
} |
||||
|
||||
public bool IsConfigured() |
||||
{ |
||||
return |
||||
(UseIIS || UseIISExpress) && IsValidIISUrl(); |
||||
} |
||||
|
||||
bool IsValidIISUrl() |
||||
{ |
||||
return !String.IsNullOrEmpty(IISUrl); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Internal.Templates; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using Rhino.Mocks; |
||||
|
||||
namespace AspNet.Mvc.Tests.Helpers |
||||
{ |
||||
public static class MSBuildProjectHelper |
||||
{ |
||||
public static MSBuildBasedProject CreateCSharpProject() |
||||
{ |
||||
var createInfo = new ProjectCreateInformation(); |
||||
createInfo.Solution = new Solution(MockRepository.GenerateStub<IProjectChangeWatcher>()); |
||||
createInfo.OutputProjectFileName = @"d:\projects\MyProject\MyProject.csproj"; |
||||
return new MSBuildBasedProject(createInfo); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Xml.Linq; |
||||
using AspNet.Mvc.Tests.Helpers; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class VisualStudioProjectExtensionTests |
||||
{ |
||||
VisualStudioProjectExtension extension; |
||||
MSBuildBasedProject msbuildProject; |
||||
|
||||
void CreateExtension() |
||||
{ |
||||
msbuildProject = MSBuildProjectHelper.CreateCSharpProject(); |
||||
CreateExtension(msbuildProject); |
||||
} |
||||
|
||||
void CreateExtension(MSBuildBasedProject msbuildProject) |
||||
{ |
||||
extension = new VisualStudioProjectExtension(msbuildProject); |
||||
} |
||||
|
||||
void CreateMSBuildProject() |
||||
{ |
||||
msbuildProject = MSBuildProjectHelper.CreateCSharpProject(); |
||||
} |
||||
|
||||
void CreateMSBuildProjectWithWebProjectProperties() |
||||
{ |
||||
CreateMSBuildProject(); |
||||
var properties = new WebProjectProperties(); |
||||
var extension = new VisualStudioProjectExtension(properties); |
||||
extension.Save(msbuildProject); |
||||
} |
||||
|
||||
void AddVisualStudioExtensionWithChildElement(string childElementName) |
||||
{ |
||||
msbuildProject.SaveProjectExtensions(VisualStudioProjectExtension.ProjectExtensionName, new XElement(childElementName)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProjectContainsExtension_MSBuildProjectHasNoVisualStudioExtension_ReturnsFalse() |
||||
{ |
||||
CreateMSBuildProject(); |
||||
|
||||
bool exists = VisualStudioProjectExtension.ProjectContainsExtension(msbuildProject); |
||||
|
||||
Assert.IsFalse(exists); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProjectContainsExtension_MSBuildProjectHasVisualStudioExtension_ReturnsTrue() |
||||
{ |
||||
CreateMSBuildProject(); |
||||
AddVisualStudioExtensionWithChildElement("Test"); |
||||
|
||||
bool exists = VisualStudioProjectExtension.ProjectContainsExtension(msbuildProject); |
||||
|
||||
Assert.IsTrue(exists); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ContainsWebProjectProperties_MSBuildProjectHasWebProjectProperties_ReturnsTrue() |
||||
{ |
||||
CreateMSBuildProjectWithWebProjectProperties(); |
||||
CreateExtension(msbuildProject); |
||||
|
||||
bool contains = extension.ContainsWebProjectProperties(); |
||||
|
||||
Assert.IsTrue(contains); |
||||
} |
||||
|
||||
[Test] |
||||
public void ContainsWebProjectProperties_MSBuildProjectDoesNotHaveWebProjectProperties_ReturnsFalse() |
||||
{ |
||||
CreateMSBuildProject(); |
||||
CreateExtension(); |
||||
|
||||
bool contains = extension.ContainsWebProjectProperties(); |
||||
|
||||
Assert.IsFalse(contains); |
||||
} |
||||
|
||||
[Test] |
||||
public void ContainsWebProjectProperties_MSBuildProjectDoesNotHaveWebProjectPropertiesButHasVisualStudioExtension_ReturnsFalse() |
||||
{ |
||||
CreateMSBuildProject(); |
||||
AddVisualStudioExtensionWithChildElement("Test"); |
||||
CreateExtension(msbuildProject); |
||||
|
||||
bool contains = extension.ContainsWebProjectProperties(); |
||||
|
||||
Assert.IsFalse(contains); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,282 @@
@@ -0,0 +1,282 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Xml.Linq; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using NUnit.Framework; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class WebProjectPropertiesTests |
||||
{ |
||||
WebProjectProperties lhs; |
||||
WebProjectProperties rhs; |
||||
|
||||
void CreateTwoWebProjectProperties() |
||||
{ |
||||
lhs = new WebProjectProperties(); |
||||
rhs = new WebProjectProperties(); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_AllPropertiesAreTheSame_ReturnsTrue() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
|
||||
Assert.AreEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_UseIISPropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.UseIIS = false; |
||||
rhs.UseIIS = true; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_Null_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
bool result = lhs.Equals(null); |
||||
|
||||
Assert.IsFalse(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_AutoAssignPortPropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.AutoAssignPort = true; |
||||
rhs.AutoAssignPort = false; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_DevelopmentServerVPathPropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.DevelopmentServerVPath = "/"; |
||||
rhs.DevelopmentServerVPath = "/Test"; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_DevelopmentServerPortPropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.DevelopmentServerPort = 8080; |
||||
rhs.DevelopmentServerPort = 7777; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_NTLMAuthenticationPropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.NTLMAuthentication = false; |
||||
rhs.NTLMAuthentication = true; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_IISUrlPropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.IISUrl = "http://localhost/"; |
||||
rhs.IISUrl = "http://localhost:1888/"; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_UseIISExpressPropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.UseIISExpress = false; |
||||
rhs.UseIISExpress = true; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_SaveServerSettingsInUserFilePropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.SaveServerSettingsInUserFile = false; |
||||
rhs.SaveServerSettingsInUserFile = true; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_CustomServerUrlPropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.CustomServerUrl = "/a"; |
||||
rhs.CustomServerUrl = "/test"; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals_UseCustomServerPropertyIsDifferent_ReturnsFalse() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.UseCustomServer = false; |
||||
rhs.UseCustomServer = true; |
||||
|
||||
Assert.AreNotEqual(lhs, rhs); |
||||
} |
||||
|
||||
[Test] |
||||
public void ToString_NewInstance_ReturnsMainPropertyValues() |
||||
{ |
||||
CreateTwoWebProjectProperties(); |
||||
lhs.UseIISExpress = false; |
||||
lhs.UseIIS = true; |
||||
lhs.IISUrl = "http://localhost"; |
||||
lhs.SaveServerSettingsInUserFile = true; |
||||
|
||||
string text = lhs.ToString(); |
||||
|
||||
string expectedText = |
||||
"[WebProjectProperties IISUrl=\"http://localhost\", UseIISExpress=False, UseIIS=True, SaveServerSettingsInUserFile=True]"; |
||||
|
||||
Assert.AreEqual(expectedText, text); |
||||
} |
||||
|
||||
[Test] |
||||
public void Constructor_WebPropertyPropertiesXElementHasNoChildElements_ExceptionNotThrown() |
||||
{ |
||||
var element = new XElement("WebPropertyProperties"); |
||||
var properties = new WebProjectProperties(element); |
||||
|
||||
Assert.AreEqual(String.Empty, properties.IISUrl); |
||||
Assert.AreEqual(String.Empty, properties.CustomServerUrl); |
||||
} |
||||
|
||||
[Test] |
||||
public void Constructor_XElementHasCustomServerUrl_CustomServerUrlPropertyPopulated() |
||||
{ |
||||
var properties = new WebProjectProperties() { CustomServerUrl = "/Test" }; |
||||
properties = new WebProjectProperties(properties.ToXElement()); |
||||
|
||||
Assert.AreEqual("/Test", properties.CustomServerUrl); |
||||
} |
||||
|
||||
[Test] |
||||
public void Constructor_XElementHasAutoAssignPort_AutoAssignPortPropertyPopulated() |
||||
{ |
||||
var properties = new WebProjectProperties() { AutoAssignPort = true }; |
||||
properties = new WebProjectProperties(properties.ToXElement()); |
||||
|
||||
Assert.IsTrue(properties.AutoAssignPort); |
||||
} |
||||
|
||||
[Test] |
||||
public void Constructor_XElementHasDevelopmentServerVPath_DevelopmentServerVPathPropertyPopulated() |
||||
{ |
||||
var properties = new WebProjectProperties() { DevelopmentServerVPath = "Test" }; |
||||
properties = new WebProjectProperties(properties.ToXElement()); |
||||
|
||||
Assert.AreEqual("Test", properties.DevelopmentServerVPath); |
||||
} |
||||
|
||||
[Test] |
||||
public void Constructor_XElementHasNTLMAuthentication_NTLMAuthenticationPropertyPopulated() |
||||
{ |
||||
var properties = new WebProjectProperties() { NTLMAuthentication = true }; |
||||
properties = new WebProjectProperties(properties.ToXElement()); |
||||
|
||||
Assert.IsTrue(properties.NTLMAuthentication); |
||||
} |
||||
|
||||
[Test] |
||||
public void Constructor_XElementHasSaveServerSettingsInUserFile_SaveServerSettingsInUserFilePropertyPopulated() |
||||
{ |
||||
var properties = new WebProjectProperties() { SaveServerSettingsInUserFile = true }; |
||||
properties = new WebProjectProperties(properties.ToXElement()); |
||||
|
||||
Assert.IsTrue(properties.SaveServerSettingsInUserFile); |
||||
} |
||||
|
||||
[Test] |
||||
public void Constructor_XElementHasUseIIS_UseIISPropertyPopulated() |
||||
{ |
||||
var properties = new WebProjectProperties() { UseIIS = true }; |
||||
properties = new WebProjectProperties(properties.ToXElement()); |
||||
|
||||
Assert.IsTrue(properties.UseIIS); |
||||
} |
||||
|
||||
[Test] |
||||
public void Constructor_XElementHasUseCustomServer_UseCustomServerPropertyPopulated() |
||||
{ |
||||
var properties = new WebProjectProperties() { UseCustomServer = true }; |
||||
properties = new WebProjectProperties(properties.ToXElement()); |
||||
|
||||
Assert.IsTrue(properties.UseCustomServer); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsConfigured_UseIISAndUseIISExpressAreBothFalse_ReturnsFalse() |
||||
{ |
||||
var properties = new WebProjectProperties() { UseIISExpress = false, UseIIS = false }; |
||||
|
||||
bool configured = properties.IsConfigured(); |
||||
|
||||
Assert.IsFalse(configured); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsConfigured_UseIISExpressIsTrueAndIISUrlIsValidUrl_ReturnsTrue() |
||||
{ |
||||
var properties = new WebProjectProperties |
||||
{ |
||||
UseIISExpress = true, |
||||
IISUrl = "http://localhost:8080/" |
||||
}; |
||||
|
||||
bool configured = properties.IsConfigured(); |
||||
|
||||
Assert.IsTrue(configured); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsConfigured_UseIISExpressIsTrueAndIISUrlIsEmptyString_ReturnsFalse() |
||||
{ |
||||
var properties = new WebProjectProperties |
||||
{ |
||||
UseIISExpress = true, |
||||
IISUrl = String.Empty |
||||
}; |
||||
|
||||
bool configured = properties.IsConfigured(); |
||||
|
||||
Assert.IsFalse(configured); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsConfigured_UseIISIsTrueAndIISUrlIsNull_ReturnsFalse() |
||||
{ |
||||
var properties = new WebProjectProperties |
||||
{ |
||||
UseIISExpress = true, |
||||
IISUrl = null |
||||
}; |
||||
|
||||
bool configured = properties.IsConfigured(); |
||||
|
||||
Assert.IsFalse(configured); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,276 @@
@@ -0,0 +1,276 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Text; |
||||
using System.Text.RegularExpressions; |
||||
using System.Xml; |
||||
using System.Xml.Linq; |
||||
|
||||
using AspNet.Mvc.Tests.Helpers; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.SharpDevelop.Internal.Templates; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using Rhino.Mocks; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class WebProjectTests |
||||
{ |
||||
MSBuildBasedProject msbuildProject; |
||||
WebProject webProject; |
||||
|
||||
void CreateMSBuildProject() |
||||
{ |
||||
msbuildProject = MSBuildProjectHelper.CreateCSharpProject(); |
||||
} |
||||
|
||||
void CreateWebProject() |
||||
{ |
||||
CreateMSBuildProject(); |
||||
CreateWebProject(msbuildProject); |
||||
} |
||||
|
||||
void CreateWebProject(MSBuildBasedProject msbuildProject) |
||||
{ |
||||
webProject = new WebProject(msbuildProject); |
||||
} |
||||
|
||||
void CreateWebProjectFromMSBuildProjectWithWebProjectProperties(WebProjectProperties properties) |
||||
{ |
||||
CreateWebProject(); |
||||
webProject.UpdateWebProjectProperties(properties); |
||||
CreateWebProject(msbuildProject); |
||||
} |
||||
|
||||
void CreateWebProjectFromMSBuildProjectWithWebProjectProperties() |
||||
{ |
||||
CreateWebProjectFromMSBuildProjectWithWebProjectProperties(new WebProjectProperties()); |
||||
} |
||||
|
||||
string GetMSBuildProjectExtensions() |
||||
{ |
||||
var fileContentsBuilder = new StringBuilder(); |
||||
var stringWriter = new StringWriter(fileContentsBuilder); |
||||
msbuildProject.MSBuildProjectFile.Save(stringWriter); |
||||
|
||||
return GetProjectExtensions(fileContentsBuilder.ToString()); |
||||
} |
||||
|
||||
string GetProjectExtensions(string text) |
||||
{ |
||||
return Regex.Match( |
||||
text, |
||||
"<ProjectExtensions>.*?</ProjectExtensions>", |
||||
RegexOptions.Singleline).Value; |
||||
} |
||||
|
||||
void SetUseIISExpressInMSBuildProjectToTrue() |
||||
{ |
||||
msbuildProject.SetProperty("UseIISExpress", "True"); |
||||
} |
||||
|
||||
void AddVisualStudioExtensionWithChildElement(string childElementName) |
||||
{ |
||||
msbuildProject.SaveProjectExtensions(VisualStudioProjectExtension.ProjectExtensionName, new XElement(childElementName)); |
||||
} |
||||
|
||||
[Test] |
||||
public void Regex_GetMSBuildProjectExtensions_ReturnsProjectExtensionsXml() |
||||
{ |
||||
string text = |
||||
"<Project>\r\n" + |
||||
" <ProjectExtensions>\r\n" + |
||||
" <foo>\r\n" + |
||||
" </foo>\r\n" + |
||||
" <ProjectExtensions>\r\n" + |
||||
"</Project>"; |
||||
|
||||
string result = GetProjectExtensions(text); |
||||
|
||||
string expectedResult = |
||||
" <ProjectExtensions>\r\n" + |
||||
" <foo>\r\n" + |
||||
" </foo>\r\n" + |
||||
" <ProjectExtensions>"; |
||||
|
||||
Assert.AreNotEqual(expectedResult, result); |
||||
} |
||||
|
||||
[Test] |
||||
public void Regex_GetMSBuildProjectExtensionsFromFullProjectXml_ReturnsProjectExtensionsXml() |
||||
{ |
||||
string text = |
||||
@"<?xml version=""1.0"" encoding=""utf-16""?>
|
||||
<Project ToolsVersion=""4.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" DefaultTargets=""Build"">
|
||||
<PropertyGroup> |
||||
<ProjectGuid>{20D05950-C385-4093-8EAF-ADF36EAA54BE}</ProjectGuid> |
||||
<Configuration Condition="" '$(Configuration)' == '' "">Debug</Configuration> |
||||
<Platform Condition="" '$(Platform)' == '' "">x86</Platform> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="" '$(Platform)' == 'x86' ""> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
</PropertyGroup> |
||||
<ProjectExtensions> |
||||
<VisualStudio> |
||||
<FlavorProperties GUID=""{349C5851-65DF-11DA-9384-00065B846F21}""> <WebProjectProperties> <UseIIS>True</UseIIS> <AutoAssignPort>False</AutoAssignPort> <DevelopmentServerPort>7777</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl>http://localhost:7777/test</IISUrl> <NTLMAuthentication>False</NTLMAuthentication> <UseCustomServer>False</UseCustomServer> <CustomServerUrl> </CustomServerUrl> <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> </WebProjectProperties></FlavorProperties>
|
||||
</VisualStudio> |
||||
</ProjectExtensions> |
||||
</Project>";
|
||||
|
||||
string result = GetProjectExtensions(text); |
||||
|
||||
string expectedResult = |
||||
@"<ProjectExtensions>
|
||||
<VisualStudio> |
||||
<FlavorProperties GUID=""{349C5851-65DF-11DA-9384-00065B846F21}""> <WebProjectProperties> <UseIIS>True</UseIIS> <AutoAssignPort>False</AutoAssignPort> <DevelopmentServerPort>7777</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl>http://localhost:7777/test</IISUrl> <NTLMAuthentication>False</NTLMAuthentication> <UseCustomServer>False</UseCustomServer> <CustomServerUrl> </CustomServerUrl> <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> </WebProjectProperties></FlavorProperties>
|
||||
</VisualStudio> |
||||
</ProjectExtensions>";
|
||||
|
||||
Assert.AreEqual(expectedResult, result); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetWebProjectProperties_NoExistingWebProjectPropertiesInMSBuildProject_ReturnsWebProjectPropertiesWithDefaultValues() |
||||
{ |
||||
CreateWebProject(); |
||||
WebProjectProperties properties = webProject.GetWebProjectProperties(); |
||||
|
||||
Assert.AreEqual(WebProject.DefaultProperties, properties); |
||||
} |
||||
|
||||
[Test] |
||||
public void UpdateWebProjectProperties_SaveServerSettingsInUserFileIsFalse_SavesPropertiesToMainProjectFile() |
||||
{ |
||||
CreateWebProject(); |
||||
WebProjectProperties properties = webProject.GetWebProjectProperties(); |
||||
properties.SaveServerSettingsInUserFile = false; |
||||
properties.DevelopmentServerPort = 7777; |
||||
properties.DevelopmentServerVPath = "/"; |
||||
properties.IISUrl = "http://localhost:7777/test"; |
||||
properties.UseIIS = true; |
||||
|
||||
webProject.UpdateWebProjectProperties(properties); |
||||
|
||||
string msbuildProjectFileContents = GetMSBuildProjectExtensions(); |
||||
|
||||
string expectedMSBuildProjectFileContents = |
||||
@"<ProjectExtensions>
|
||||
<VisualStudio> |
||||
<FlavorProperties GUID=""{349C5851-65DF-11DA-9384-00065B846F21}""> |
||||
<WebProjectProperties> |
||||
<UseIIS>True</UseIIS> |
||||
<AutoAssignPort>False</AutoAssignPort> |
||||
<DevelopmentServerPort>7777</DevelopmentServerPort> |
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath> |
||||
<IISUrl>http://localhost:7777/test</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication> |
||||
<UseCustomServer>False</UseCustomServer> |
||||
<CustomServerUrl></CustomServerUrl> |
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> |
||||
</WebProjectProperties> |
||||
</FlavorProperties> |
||||
</VisualStudio> |
||||
</ProjectExtensions>";
|
||||
|
||||
Assert.AreEqual(expectedMSBuildProjectFileContents, msbuildProjectFileContents); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetWebProjectProperties_MSBuildHasWebProjectProperties_ReadsWebProjectPropertiesFromMSBuildProject() |
||||
{ |
||||
var expectedProperties = new WebProjectProperties |
||||
{ |
||||
DevelopmentServerPort = 8989, |
||||
IISUrl = "http://localhost:8989/test" |
||||
}; |
||||
CreateWebProjectFromMSBuildProjectWithWebProjectProperties(expectedProperties); |
||||
|
||||
WebProjectProperties properties = webProject.GetWebProjectProperties(); |
||||
|
||||
Assert.AreEqual(expectedProperties, properties); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetWebProjectProperties_MSBuildHasUseIISExpressPropertySetToTrue_UseIISExpressPropertyIsTrue() |
||||
{ |
||||
CreateWebProjectFromMSBuildProjectWithWebProjectProperties(); |
||||
SetUseIISExpressInMSBuildProjectToTrue(); |
||||
|
||||
var properties = webProject.GetWebProjectProperties(); |
||||
|
||||
var expectedProperties = new WebProjectProperties { UseIISExpress = true }; |
||||
|
||||
Assert.AreEqual(expectedProperties, properties); |
||||
} |
||||
|
||||
[Test] |
||||
public void UpdateWebProjectProperties_UseIISExpressIsTrue_MSBuildProjectIISExpressPropertySetToTrue() |
||||
{ |
||||
CreateWebProject(); |
||||
var properties = new WebProjectProperties { UseIISExpress = true }; |
||||
|
||||
webProject.UpdateWebProjectProperties(properties); |
||||
|
||||
string value = msbuildProject.GetEvaluatedProperty("UseIISExpress"); |
||||
|
||||
Assert.AreEqual("True", value); |
||||
} |
||||
|
||||
[Test] |
||||
public void UseIISExpress_MSBuildUseIISExpressIsTrue_ReturnsTrue() |
||||
{ |
||||
CreateWebProject(); |
||||
msbuildProject.SetProperty("UseIISExpress", "True"); |
||||
|
||||
bool result = webProject.UseIISExpress; |
||||
|
||||
Assert.IsTrue(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void UseIISExpress_MSBuildHasNoUseIISExpressProperty_ReturnsFalse() |
||||
{ |
||||
CreateWebProject(); |
||||
|
||||
bool result = webProject.UseIISExpress; |
||||
|
||||
Assert.IsFalse(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasWebProjectProperties_MSBuildHasNoWebProjectProperties_ReturnsFalse() |
||||
{ |
||||
CreateWebProject(); |
||||
|
||||
bool result = webProject.HasWebProjectProperties(); |
||||
|
||||
Assert.IsFalse(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasWebProjectProperties_MSBuildHasWebProjectProperties_ReturnsTrue() |
||||
{ |
||||
CreateWebProjectFromMSBuildProjectWithWebProjectProperties(); |
||||
|
||||
bool result = webProject.HasWebProjectProperties(); |
||||
|
||||
Assert.IsTrue(result); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasWebProjectProperties_MSBuildProjectDoesNotHaveWebProjectPropertiesButHasVisualStudioExtension_ReturnsFalse() |
||||
{ |
||||
CreateMSBuildProject(); |
||||
AddVisualStudioExtensionWithChildElement("Test"); |
||||
CreateWebProject(msbuildProject); |
||||
|
||||
bool contains = webProject.HasWebProjectProperties(); |
||||
|
||||
Assert.IsFalse(contains); |
||||
} |
||||
} |
||||
} |
Binary file not shown.
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
Copyright (c) 2005 - 2009 Ayende Rahien (ayende@ayende.com) |
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, |
||||
are permitted provided that the following conditions are met: |
||||
|
||||
* Redistributions of source code must retain the above copyright notice, |
||||
this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright notice, |
||||
this list of conditions and the following disclaimer in the documentation |
||||
and/or other materials provided with the distribution. |
||||
* Neither the name of Ayende Rahien nor the names of its |
||||
contributors may be used to endorse or promote products derived from this |
||||
software without specific prior written permission. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Loading…
Reference in new issue