[Fact]//Repository.HaikuRepo.cs public void HaikuRepoTest1() { HaikuRepo haikurepo = new HaikuRepo(hContext); HaikuLine haikuline = new HaikuLine(); haikuline.Line = "Coffee is my life"; haikuline.Tags = "coffee life silly"; haikuline.Syllable = 5; haikuline.Approved = false; haikuline.Username = "******"; RawUser rawuser = new RawUser(); rawuser.Username = "******"; rawuser.FirstName = "Chris"; rawuser.LastName = "Larson"; rawuser.Password = "******"; UserRepo userrepo = new UserRepo(hContext); UserMethods usermethods = new UserMethods(userrepo); User user = usermethods.UserRegister(rawuser); haikuline.User = user; var actual = haikurepo.SaveLine(haikuline).Username; var expected = "Chris123"; Assert.Equal(expected, actual); }
[Fact]//Repository.HaikuRepo.cs public void HaikuRepoTest3() { HaikuRepo haikurepo = new HaikuRepo(hContext); HaikuLine haikuline = new HaikuLine(); haikuline.Line = "I can not live without it"; haikuline.Tags = "life silly"; haikuline.Syllable = 7; haikuline.Approved = true; haikuline.Username = "******"; RawUser rawuser = new RawUser(); rawuser.Username = "******"; rawuser.FirstName = "Chris"; rawuser.LastName = "Larson"; rawuser.Password = "******"; UserRepo userrepo = new UserRepo(hContext); UserMethods usermethods = new UserMethods(userrepo); User user = usermethods.GetUser(rawuser.Username); haikuline.User = user; var actual = haikurepo.SaveLine(haikuline).Username; var expected = "Chris123"; Assert.Equal(expected, actual); }
/// <summary> /// Method will pass a haiku line to the repolayer so a haiku line /// that was submitted can be saved to the db and later be reviewed by /// an admin user /// </summary> /// <param name="hl"></param> /// <returns></returns> public HaikuLine SubmitHaikuLine(HaikuLine hl) { HaikuLine newline = _repolayer.SaveLine(hl); return(newline); }