/// <summary> /// Creates mock projections that can be used during testing. /// </summary> public void CreateMockProjections(ProjectionFileNamer namer) { ProjectionInfo info1 = new ProjectionInfo(); info1.Action = "Create"; info1.TypeName = "User"; info1.ProjectionFilePath = "Projections/User-Create.ascx"; string projection1Path = namer.CreateProjectionFilePath(info1); if (!Directory.Exists(Path.GetDirectoryName(projection1Path))) Directory.CreateDirectory(Path.GetDirectoryName(projection1Path)); using (StreamWriter writer = File.CreateText(projection1Path)) { writer.Write("[mock content]"); writer.Close(); } }
protected void CreateMockProjections() { string appName = "MockApplication"; ProjectionFileNamer namer = new ProjectionFileNamer(); namer.FileMapper = new MockFileMapper(this, TestUtilities.GetTestingPath(this), appName); namer.ProjectionsDirectoryPath = TestUtilities.GetTestApplicationPath(this, appName) + Path.DirectorySeparatorChar + "Projections"; ProjectionInfo info1 = new ProjectionInfo(); info1.Action = "Edit"; info1.TypeName = "TestUser"; info1.ProjectionFilePath = "/Projections/TestUser-Edit.ascx"; string projection1Path = namer.CreateProjectionFilePath(info1); if (!Directory.Exists(Path.GetDirectoryName(projection1Path))) Directory.CreateDirectory(Path.GetDirectoryName(projection1Path)); string content = @"<?xml version=""1.0"" encoding=""utf-8""?> <ProjectionInfo xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <Name>User-Edit</Name> <Action>Edit</Action> <TypeName>User</TypeName> <ProjectionFilePath>/Projections/User-Create-Edit.ascx</ProjectionFilePath> <Format>Html</Format> <MenuTitle /> <MenuCategory /> <ShowOnMenu>false</ShowOnMenu> <Enabled>true</Enabled> </ProjectionInfo>"; using (StreamWriter writer = File.CreateText(projection1Path)) { writer.Write(content); writer.Close(); } }
public void InitializeMockProjections() { string appName = "MockApplication"; ProjectionFileNamer namer = new ProjectionFileNamer(); namer.FileMapper = new MockFileMapper(this, TestUtilities.GetTestingPath(this), appName); namer.ProjectionsDirectoryPath = TestUtilities.GetTestApplicationPath(this, appName) + Path.DirectorySeparatorChar + "Projections"; ProjectionInfo info1 = new ProjectionInfo(); info1.Action = "Create"; info1.TypeName = "User"; info1.ProjectionFilePath = "Projections/User-Create.ascx"; string projection1Path = namer.CreateProjectionFilePath(info1); if (!Directory.Exists(Path.GetDirectoryName(projection1Path))) Directory.CreateDirectory(Path.GetDirectoryName(projection1Path)); using (StreamWriter writer = File.CreateText(projection1Path)) { writer.Write("[mock content]"); writer.Close(); } }