public void Test2MembersPrintAsPdf()
        {
            var member1 = new Member();

            member1.Nom    = "Jeanniard";
            member1.Prenom = "Luc";

            var member2 = new Member();

            member2.Nom    = "Jeanniard";
            member2.Prenom = "Matti";

            var memberList = new List <Member>();

            memberList.Add(member1);
            memberList.Add(member2);

            var outPutPath             = Path.GetTempPath();
            var expectedOutputFileName = Path.Combine(outPutPath, "JudoMembers" + ".pdf");
            var errorMessage           = "";

            Assert.IsTrue(MemberPrinter.PrintAsPdf(memberList, outPutPath, out errorMessage));
            Assert.IsTrue(File.Exists(expectedOutputFileName));
            Assert.IsTrue(String.IsNullOrEmpty(errorMessage));
            //Process.Start(expectedOutputFileName);
            File.Delete(expectedOutputFileName);
        }
        public void TestMemberPrintAsPdfForFailureWhenPathDoesNotExists()
        {
            var member = new Member();

            var outPutPath             = @"X:\Temp\";
            var expectedOutputFileName = Path.Combine(outPutPath, member.Prenom + member.Nom + ".pdf");
            var errorMessage           = "";

            Assert.IsFalse(MemberPrinter.PrintAsPdf(member, outPutPath, out errorMessage));
            Assert.IsFalse(String.IsNullOrEmpty(errorMessage));
        }
        public void TestMemberPrintAsPdfForSuccess()
        {
            var member = new Member();

            member.Nom    = "Jeanniard";
            member.Prenom = "Luc";
            member.Nom    = "Jeanniard";

            var outPutPath             = Path.GetTempPath();
            var expectedOutputFileName = Path.Combine(outPutPath, member.Prenom + "_" + member.Nom + ".pdf");
            var errorMessage           = "";

            Assert.IsTrue(MemberPrinter.PrintAsPdf(member, outPutPath, out errorMessage));
            Assert.IsTrue(File.Exists(expectedOutputFileName));
            Assert.IsTrue(String.IsNullOrEmpty(errorMessage));
            File.Delete(expectedOutputFileName);
        }
Пример #4
0
 private void imprimerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MemberPrinter.Print(GetSelectedMembers());
 }
Пример #5
0
 private void btn_print_Click(object sender, EventArgs e)
 {
     MemberPrinter.Print(Member);
 }