internal static Category ToCategory(Abstractions.Model.Category category) { return(new Category { Code = Sanitizer.SanitizeCode(category.Code), DisplayName = category.DisplayName, Version = 0 }); }
internal static Project ToProject(Abstractions.Model.Project project) { var dbProject = new Project { Id = project.Id ?? 0, Code = Sanitizer.SanitizeCode(project.Code), Description = project.Description, DescriptionShort = project.DescriptionShort, DisplayName = project.DisplayName, PosterDescription = project.PosterDescription, PosterUrl = project.PosterUrl, ReleaseDate = project.ReleaseDate, Version = project.Version, CategoryId = project.Category.Id.Value, ExternalUrls = new List <ProjectExternalUrl>(), GalleryImages = new List <GalleryImage>() }; foreach (var item in ToProjectExternalUrls(project.ExternalUrls)) { item.Project = dbProject; item.ProjectId = dbProject.Id; dbProject.ExternalUrls.Add(item); } foreach (var item in ToGalleryImage(project.GalleryImages)) { item.Project = dbProject; item.ProjectId = dbProject.Id; dbProject.GalleryImages.Add(item); } return(dbProject); }
public void SanitizeCode_Valid(string input, string expected) { var result = Sanitizer.SanitizeCode(input); Assert.Equal(result, expected); }