public void CreateSuccess() { var newsEntry = NewsEntry.Create(); newsEntry.AddContent(LanguageCodes.English, "title", "text"); newsEntry.AddContent(LanguageCodes.German, "titel", "deutscher text"); // Assert Assert.AreEqual("title", newsEntry.GetContentForLanguage(LanguageCodes.English).Title); Assert.AreEqual("titel", newsEntry.GetContentForLanguage(LanguageCodes.German).Title); }
public void AddDuplicateContentForLanguage() { // Arrange // Act var newsEntry = NewsEntry.Create(); newsEntry.AddContent(LanguageCodes.English, "title", "text"); newsEntry.AddContent(LanguageCodes.English, "title2", "text2"); // Assert }
public void PostNews(DTO.News.NewsContent[] newsContents) { var newsEntry = NewsEntry.Create(); newsEntry.CreatedById = this.userProvider.GetCurrentUserId(); newsEntry.CreatedAt = DateTime.UtcNow; foreach (var newsContent in newsContents) { newsEntry.AddContent(newsContent.Language, newsContent.Title, newsContent.Text); } this.UnitOfWork.News.Add(newsEntry); this.UnitOfWork.Commit(); }
public override async Task Seed(ImperaContext context) { await base.Seed(context); if (context.MapTemplates.FirstOrDefault(x => x.Name == "TestMap") == null) { context.MapTemplates.Add(new Domain.Map.MapTemplateDescriptor { Name = "TestMap", LastModifiedAt = DateTime.UtcNow, CreatedAt = DateTime.UtcNow }); } // Add dummy news entry var newsEntry = NewsEntry.Create(); newsEntry.CreatedBy = context.Users.FirstOrDefault(x => x.UserName == "System"); newsEntry.CreatedAt = DateTime.UtcNow; newsEntry.AddContent("en", "DB initialized", "DB has been updated"); context.NewsEntries.Add(newsEntry); context.SaveChanges(); }