private void ValidateVideo(Video video) { if (video.NameEmpty()) { throw new FieldEnteredNotCorrect("The name cannot be empty"); } if (video.AuthorEmpty()) { throw new FieldEnteredNotCorrect("The author cannot be empty"); } if (video.LinkVideoEmpty()) { throw new FieldEnteredNotCorrect("The link video cannot be empty"); } if (video.CategoryVideoEmpty()) { throw new FieldEnteredNotCorrect("You must add a category to the video"); } if (video.HourIsEmpty() && video.MinSecondsIsEmpty()) { throw new FieldEnteredNotCorrect("Video must have duration"); } if (video.Hour < 0 || video.MinSeconds < 0) { throw new FieldEnteredNotCorrect("Video duration must be positive"); } ValidateCategoriesId(video); ValidatePlaylistId(video); ValidateCategoryUnique(video); ValidatePlaylistUnique(video); }
public bool ValidateVideoToAdd(Video video) { if (video.NameEmpty()) { return(false); } if (video.AuthorEmpty()) { return(false); } if (video.LinkVideoEmpty()) { return(false); } if (video.CategoryVideoEmpty()) { return(false); } if (video.HourIsEmpty() && video.MinSecondsIsEmpty()) { return(false); } if (video.Hour < 0 || video.MinSeconds < 0) { return(false); } if (ValidateCategoryVideo(video) == false) { return(false); } if (ExistVideoByName(video) == true) { if (ValidatePlaylistVideo(video) == false) { return(false); } } return(true); }
public void AuthorEmpty() { video.Author = ""; Assert.IsTrue(video.AuthorEmpty()); }