[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]//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]//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 HaikuController(HaikuGenerator haukuGenerator, HaikuMethods haikuMethod) { _haukuGenerator = haukuGenerator; _haikuMethod = haikuMethod; }