public override void GetEntityById_EntityDoesExist_ReturnsEntity() { var title = TitleCommands.SaveTitle(new Title { Description = RandomUtil.GetRandomString() }, Context); Assert.IsNotNull(TitleQueries.GetTitleById(Context, title.IdTitle)); }
public void GetTitleByPartOfDescription_ReturnsListOfTitles() { var description = RandomUtil.GetRandomString(25); TitleCommands.SaveTitle(new Title { Description = description }, Context); var titles = TitleQueries.GetTitlesByPartOfDescription(Context, description.Substring(RandomUtil.GetRandomNumber(1), RandomUtil.GetRandomNumber(1) + 1)); Assert.IsNotEmpty(titles); Assert.IsNotNull(titles.Where(t => t.Description.Contains(description))); }
public override void SaveEntity_EntityExists_EntityIsUpdated() { var description = RandomUtil.GetRandomAlphaNumericString(25); var title = TitleCommands.SaveTitle(new Title { Description = description }, Context); var newDescription = RandomUtil.GetRandomAlphaNumericString(30); title.Description = newDescription; title.SaveTitle(Context); var titleDb = TitleQueries.GetTitleById(Context, title.IdTitle); Assert.AreNotEqual(description, titleDb.Description); Assert.AreEqual(newDescription, titleDb.Description); }
public override void GetEntityById_EntityDoesNotExist_ReturnsNull() { Assert.IsNull(TitleQueries.GetTitleById(Context, -1)); }