public StoryPostQueryFixture() { Context = TestSpmsContextFactory.Create(); var game = Context.Game.First(); Context.Biography.Add(new Domain.Models.Biography() { Firstname = "Dan", Surname = "Taylor", Player = new Player() { AuthString = "123" }, State = new BiographyState() { Default = false, Name = "State", GameId = game.Id }, Posting = new Posting() { Name = "Starbase Gamma" } }); Context.SaveChanges(); var ipsum = new NLipsum.Core.LipsumGenerator(); var sentences = ipsum.GenerateSentences(3, new Sentence(5, 20)); var episodeEntry = new EpisodeEntry() { Title = sentences[0], Location = sentences[1], Timeline = sentences[2], Content = ipsum.GenerateLipsum(5), EpisodeId = Context.Episode.First().Id, EpisodeEntryTypeId = Context.EpisodeEntryType.First(x => x.Name == StaticValues.Post).Id, EpisodeEntryStatusId = Context.EpisodeEntryStatus.First(x => x.Name == StaticValues.Published).Id }; Context.EpisodeEntry.Add(episodeEntry); Context.SaveChanges(); var configurationProvider = new MapperConfiguration(cfg => { cfg.AddProfile <ApplicationMapper>(); }); Mapper = configurationProvider.CreateMapper(); }
public void TestGenerateSentences() { string rawText = Lipsums.LoremIpsum; LipsumGenerator lipsum = new LipsumGenerator(rawText, false); int desiredSentenceCount = 5; string[] generatedSentences = lipsum. GenerateSentences(desiredSentenceCount, Sentence.Medium); Assert.AreEqual(desiredSentenceCount, generatedSentences.Length, "Retrieved sentence count mismatch."); for (int i = 0; i < desiredSentenceCount; i++) { Assert.IsNotNull(generatedSentences[i], String.Format("Generated sentence [{0}] is null.", i)); #if PORTABLE Assert.IsNotEmpty(generatedSentences[i]); #else StringAssert.IsNonEmpty(generatedSentences[i]); #endif } }
public void TestSentenceCapitalizationAndPunctuation() { string rawText = "this"; LipsumGenerator lipsum = new LipsumGenerator(rawText, false); string[] generatedSentences = lipsum.GenerateSentences(1, new Sentence(1, 1)); string desiredSentence = "This."; Assert.AreEqual(desiredSentence, generatedSentences[0]); }
public void TestSingleSentence_DoesNotThrow_ArgumentOutOfRangeException() { // From reported issue: http://code.google.com/p/nlipsum/issues/detail?id=3 var lipsum = new LipsumGenerator(); bool hasThrownArgException = false; try { lipsum.GenerateSentences(1, Sentence.Short); } catch (ArgumentException ex) { hasThrownArgException = true; } Assert.IsFalse(hasThrownArgException); }