public void CreateDiplomas_ShouldReturnCorrectDocument() { ComponentInfo.SetLicense("FREE-LIMITED-KEY"); var documentModel = new DocumentModel(); Subject Limba = new Subject { SubjectName = "Limba Romana", Grade = 10 }; List <Subject> grade = new List <Subject> { Limba }; StudentModel student = new StudentModel { FirstName = "Movila", LastName = "Sergiu", Grades = grade }; var stringgCreator = new Mock <IStringCreator>(); stringgCreator.Setup(s => s.GetFirstParagraph("Movila", "Sergiu")).Returns("Diploma \n\n Studii Medii\nMovila Sergiu"); stringgCreator.Setup(s => s.GetSecondParagraphText(It.IsAny <IEnumerable <Subject> >())).Returns("Limba romana 10\n"); //documentModel.Sections.Add(new Section(documentModel, // new List<Paragraph>() { new Paragraph(documentModel, firstparagraph ), new Paragraph(documentModel, secondParagraphText) })); var sut = new FileWriterBuilder().WithStringCreator(stringgCreator).Build(); var act = sut.CreateDiplomas(student); act.Should().BeSameAs(documentModel); }
public void CreateDiplomas_CallingSecondParagraph_Once() { var student = new StudentModel(); var stringCreator = new Mock <IStringCreator>(); var sut = new FileWriterBuilder().WithStringCreator(stringCreator).Build(); sut.CreateDiplomas(student); stringCreator.Verify(s => s.GetSecondParagraphText(It.IsAny <IEnumerable <Subject> >()), Times.Once); }
public void CreateDiplomas_CallingFirstParagraph_Once() { var student = new StudentModel(); var stringCreator = new Mock <IStringCreator>(); var sut = new FileWriterBuilder().WithStringCreator(stringCreator).Build(); sut.CreateDiplomas(student); stringCreator.Verify(s => s.GetFirstParagraph(It.IsAny <string>(), It.IsAny <string>()), Times.Once); }