public void FindProjectMappingShouldReturnNull() { ProjectMapping.Configuration.ProjectMappingEntry projectMapping = info.ProjectMappingTables[0].FindProjectMappingByProjectId(Guid.NewGuid()); Assert.IsNull(projectMapping, "Not null"); }
public void FindProjectMappingShouldReturnValue() { ProjectMapping.Configuration.ProjectMappingEntry projectMapping = info.ProjectMappingTables[0].FindProjectMappingByProjectId(projectId); Assert.IsNotNull(projectMapping, "Null"); }
public void ShouldReturnProjectMappingIfMappingTableExist() { ProjectMapping.Configuration.ProjectMappingEntry mapping = manager.GetProjectMappingEntry(WcfMappingTableName, ProjectId1); Assert.IsNotNull(mapping); Assert.AreEqual <Guid>(ProjectId1, new Guid(mapping.ProjectId)); }
/// <summary> /// Deletes the project mapping entry. /// </summary> /// <param name="projectMappingTableName">Name of the project mapping table.</param> /// <param name="projectId">The project id.</param> public void DeleteProjectMappingEntry(string projectMappingTableName, Guid projectId) { Guard.ArgumentNotNullOrEmptyString(projectMappingTableName, "projectMappingTableName"); GuidGuard.GuidNotEmpty(projectId, "projectId"); ProjectMappingTable projectMappingTable = this.ProjectMappingInformation.FindProjectMappingTableByName(projectMappingTableName); if (projectMappingTable == null) { throw new ProjectMappingTableNotFoundException(Properties.Resources.ProjectMappingTableNotFound); } ProjectMapping.Configuration.ProjectMappingEntry projectMapping = projectMappingTable.FindProjectMappingByProjectId(projectId); if (projectMapping == null) { throw new ProjectMappingNotFoundException(Properties.Resources.ProjectNotFound); } //Delete ProjectMapping projectMappingTable.ProjectMappings.Remove(projectMapping); UpdateMappingFile(); }
public void ShouldNotAddAProjectMappingEntryThatAlreadyExists() { Guid projectGuid = new Guid("4A216B22-B2B2-4851-AFFA-B7A5AF147645"); ProjectMapping.Configuration.ProjectMappingEntry projectMapping = new ProjectMapping.Configuration.ProjectMappingEntry( projectGuid, @"\Foo", "FooName"); projectMapping.Roles.Add(new Role("FooRole")); manager.AddProjectMappingEntry(WcfMappingTableName, projectMapping); }
public void Setup() { projectId = Guid.NewGuid(); Role role = new Role("FooRole"); Role role1 = new Role("FooRole1"); ProjectMapping.Configuration.ProjectMappingEntry projectMapping = new ProjectMapping.Configuration.ProjectMappingEntry( projectId, @"\", "FooName"); projectMapping.Roles.Add(role); projectMapping.Roles.Add(role1); ProjectMappingTable mappingTable = new ProjectMappingTable("Foo"); mappingTable.ProjectMappings.Add(projectMapping); info = new ProjectMappingInformation("Foo.rolemapping"); info.ProjectMappingTables.Add(mappingTable); }
public void ShouldNotDeleteAProjectMappingEntryTwice() { Guid projectGuid = new Guid("A168E8C3-8CCD-47cd-AE2B-BE0F85F66782"); ProjectMapping.Configuration.ProjectMappingEntry projectMapping = new ProjectMapping.Configuration.ProjectMappingEntry( projectGuid, @"\Foo", "FooName"); ProjectMappingTable projectMappingTable = new ProjectMappingTable("FooEntry2"); manager.AddProjectMappingTableEntry(projectMappingTable); manager.AddProjectMappingEntry("FooEntry2", projectMapping); manager.DeleteProjectMappingEntry("FooEntry2", projectGuid); manager.DeleteProjectMappingEntry("FooEntry2", projectGuid); }
public void Setup() { projectId = Guid.NewGuid(); Role role = new Role("FooRole"); Role role1 = new Role("FooRole1"); ProjectMapping.Configuration.ProjectMappingEntry projectMapping = new ProjectMapping.Configuration.ProjectMappingEntry( projectId, @"\", "FooName"); projectMapping.Roles.Add(role); projectMapping.Roles.Add(role1); ProjectMappingTable mappingTable = new ProjectMappingTable("Foo"); mappingTable.ProjectMappings.Add(projectMapping); info = new ProjectMappingInformation("Foo.rolemapping"); info.ProjectMappingTables.Add(mappingTable); }
public void ShouldAddAProjectMappingEntry() { Guid projectGuid = new Guid("0D0429A4-2E7B-413b-92DB-2F5E048667C8"); ProjectMapping.Configuration.ProjectMappingEntry projectMapping = new ProjectMapping.Configuration.ProjectMappingEntry( projectGuid, @"\Foo", "FooName"); projectMapping.Roles.Add(new Role("FooRole")); manager.AddProjectMappingEntry(WcfMappingTableName, projectMapping); string projectPath = manager.GetProjectPath(WcfMappingTableName, projectGuid); ReadOnlyCollection <Role> roles = manager.GetProjectRoles(WcfMappingTableName, projectGuid); Assert.AreEqual(roles.Count, 1, "Not Equal"); Assert.AreEqual(roles[0].Name, "FooRole", "Not Equal"); Assert.AreEqual(projectPath, @"\Foo", "Not Equal"); }
/// <summary> /// Adds the project mapping entry. /// </summary> /// <param name="projectMappingTableName">Name of the project mapping table.</param> /// <param name="projectMapping">The project mapping.</param> public void AddProjectMappingEntry(string projectMappingTableName, ProjectMapping.Configuration.ProjectMappingEntry projectMapping) { Guard.ArgumentNotNullOrEmptyString(projectMappingTableName, "projectMappingTableName"); Guard.ArgumentNotNull(projectMapping, "projectMapping"); ProjectMappingTable projectMappingTable = this.ProjectMappingInformation.FindProjectMappingTableByName(projectMappingTableName); if (projectMappingTable == null) { throw new ProjectMappingTableNotFoundException(Properties.Resources.ProjectMappingTableNotFound); } if (projectMappingTable.FindProjectMappingByProjectId(new Guid(projectMapping.ProjectId)) != null) { throw new ProjectMappingAlreadyExistsException(Properties.Resources.ProjectMappingAlreadyExists); } //Add ProjectMapping projectMappingTable.ProjectMappings.Add(projectMapping); UpdateMappingFile(); }
/// <summary> /// Gets the project path. /// </summary> /// <param name="projectMappingTableName">Name of the project mapping table.</param> /// <param name="projectId">The project id.</param> /// <returns></returns> public string GetProjectPath(string projectMappingTableName, Guid projectId) { Guard.ArgumentNotNullOrEmptyString(projectMappingTableName, "projectMappingTableName"); GuidGuard.GuidNotEmpty(projectId, "projectId"); ProjectMappingTable projectMappingTable = this.ProjectMappingInformation.FindProjectMappingTableByName(projectMappingTableName); if (projectMappingTable == null) { throw new ProjectMappingTableNotFoundException(Properties.Resources.ProjectMappingTableNotFound); } ProjectMapping.Configuration.ProjectMappingEntry projectMapping = projectMappingTable.FindProjectMappingByProjectId(projectId); if (projectMapping == null) { throw new ProjectMappingNotFoundException(Properties.Resources.ProjectNotFound); } return(projectMapping.ProjectPath); }
public void FindProjectMappingWithNullArgument() { ProjectMapping.Configuration.ProjectMappingEntry projectMapping = info.ProjectMappingTables[0].FindProjectMappingByProjectId(Guid.Empty); }
public void ShouldNotDeleteAProjectMappingEntryTwice() { Guid projectGuid = new Guid("A168E8C3-8CCD-47cd-AE2B-BE0F85F66782"); ProjectMapping.Configuration.ProjectMappingEntry projectMapping = new ProjectMapping.Configuration.ProjectMappingEntry( projectGuid, @"\Foo", "FooName"); ProjectMappingTable projectMappingTable = new ProjectMappingTable("FooEntry2"); manager.AddProjectMappingTableEntry(projectMappingTable); manager.AddProjectMappingEntry("FooEntry2", projectMapping); manager.DeleteProjectMappingEntry("FooEntry2", projectGuid); manager.DeleteProjectMappingEntry("FooEntry2", projectGuid); }
public void ShouldAddAProjectMappingEntry() { Guid projectGuid = new Guid("0D0429A4-2E7B-413b-92DB-2F5E048667C8"); ProjectMapping.Configuration.ProjectMappingEntry projectMapping = new ProjectMapping.Configuration.ProjectMappingEntry( projectGuid, @"\Foo", "FooName"); projectMapping.Roles.Add(new Role("FooRole")); manager.AddProjectMappingEntry(WcfMappingTableName, projectMapping); string projectPath = manager.GetProjectPath(WcfMappingTableName, projectGuid); ReadOnlyCollection<Role> roles = manager.GetProjectRoles(WcfMappingTableName, projectGuid); Assert.AreEqual(roles.Count, 1, "Not Equal"); Assert.AreEqual(roles[0].Name, "FooRole", "Not Equal"); Assert.AreEqual(projectPath, @"\Foo", "Not Equal"); }
public void ShouldNotAddAProjectMappingEntryThatAlreadyExists() { Guid projectGuid = new Guid("4A216B22-B2B2-4851-AFFA-B7A5AF147645"); ProjectMapping.Configuration.ProjectMappingEntry projectMapping = new ProjectMapping.Configuration.ProjectMappingEntry( projectGuid, @"\Foo", "FooName"); projectMapping.Roles.Add(new Role("FooRole")); manager.AddProjectMappingEntry(WcfMappingTableName, projectMapping); }