[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); }
[Fact]//Controllers.HaikuController.cs public void HaikuControllerTest6() { HaikuRepo haikuRepo = new HaikuRepo(hContext); UserRepo userRepo = new UserRepo(hContext); HaikuGenerator haikugen = new HaikuGenerator(haikuRepo); HaikuMethods haikuMethods = new HaikuMethods(haikuRepo); HaikuController haikucon = new HaikuController(haikugen, haikuMethods); RawHaikuLine newLine = new RawHaikuLine(); newLine.syllable = 5; newLine.line = "Just another test line"; newLine.tags = "huh"; newLine.username = "******"; HaikuDTO haiku = new HaikuDTO(); haiku.haikuLine1 = newLine.line; var actionhaikuline = haikucon.SubmitHaikuLine(newLine); newLine.syllable = 7; newLine.line = "Is this the real life?"; newLine.tags = "who"; haiku.haikuLine2 = newLine.line; actionhaikuline = haikucon.SubmitHaikuLine(newLine); newLine.syllable = 5; newLine.line = "Is this just fantasy"; newLine.tags = "where"; haiku.haikuLine3 = newLine.line; actionhaikuline = haikucon.SubmitHaikuLine(newLine); var activonhaiku = haikucon.SubmitHaiku(haiku); var expected = true; var actual = haikucon.ApproveHaiku(1).Value; Assert.Equal(expected, actual); }
[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]//HaikuGenerator.cs public void HaikuGeneratorTest3() { HaikuRepo haikurepo = new HaikuRepo(hContext); HaikuMethods haikumethods = new HaikuMethods(haikurepo); HaikuGenerator haikugen = new HaikuGenerator(haikurepo); HaikuController haikucon = new HaikuController(haikugen, haikumethods); RawHaikuLine newLine = new RawHaikuLine(); newLine.syllable = 5; newLine.line = "Just another test line"; newLine.tags = "huh"; newLine.username = "******"; var actionhaiku = haikucon.SubmitHaikuLine(newLine); newLine.syllable = 7; newLine.line = "Is this the real life?"; newLine.tags = "who"; actionhaiku = haikucon.SubmitHaikuLine(newLine); newLine.syllable = 5; newLine.line = "Is this just fantasy"; newLine.tags = "where"; actionhaiku = haikucon.SubmitHaikuLine(newLine); HaikuDTO haiku = haikucon.GenerateHaiku().Value; var expected = true; var actual = (haiku != null); Assert.Equal(expected, actual); }
[Fact]//Repository.HaikuRepo.cs public void HaikuRepoTest8() { HaikuRepo haikurepo = new HaikuRepo(hContext); HaikuLine haikuline = haikurepo.GetHaiku5(); var expected = 5; var actual = haikuline.Syllable; Assert.Equal(expected, actual); }
[Fact]//Controllers.HaikuController.cs public void HaikuControllerTest5() { HaikuRepo haikuRepo = new HaikuRepo(hContext); UserRepo userRepo = new UserRepo(hContext); HaikuGenerator haikugen = new HaikuGenerator(haikuRepo); HaikuMethods haikuMethods = new HaikuMethods(haikuRepo); HaikuController haikuCon = new HaikuController(haikugen, haikuMethods); var expected = true; var actual = (haikuCon.GetAllHaikus().Value != null); Assert.Equal(expected, actual); }
[Fact]//HaikuGenerator.cs public void HaikuGeneratorTest2() { HaikuRepo haikurepo = new HaikuRepo(hContext); HaikuMethods haikumethods = new HaikuMethods(haikurepo); HaikuGenerator haikugen = new HaikuGenerator(haikurepo); HaikuController haikucon = new HaikuController(haikugen, haikumethods); RawHaikuLine newLine = new RawHaikuLine(); newLine.syllable = 7; newLine.line = "Just a test line"; var actionhaiku = haikucon.SubmitHaikuLine(newLine); haikugen.MakeHaiku(); var expected = true; var actual = (haikugen.Line1 != null); Assert.Equal(expected, actual); }
[Fact]//HaikuGenerator.cs public void HaikuGeneratorTest1() { HaikuRepo haikurepo = new HaikuRepo(hContext); HaikuGenerator haikugen = new HaikuGenerator(haikurepo); HaikuLine line1 = new HaikuLine(); HaikuLine line2 = new HaikuLine(); HaikuLine line3 = new HaikuLine(); line1.Line = "Coffee is my life"; line2.Line = "I can not live without it"; line3.Line = "Sleep is for the weak"; haikugen.Line1 = line1; haikugen.Line2 = line2; haikugen.Line3 = line3; var expected = "Coffee is my life I can not live without it Sleep is for the weak"; var actual = haikugen.Line1.Line + " " + haikugen.Line2.Line + " " + haikugen.Line3.Line; Assert.Equal(expected, actual); }
public HaikuMethods(HaikuRepo repolayer) { _repolayer = repolayer; }
public HaikuGenerator(HaikuRepo repo) { _repo = repo; }