ファックスを送信するために自分のC#プログラムをテストするにはどうすればよいですか?どのようにC#ファックスプログラムをテストするには?
namespace FAX
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
SendFax(textBox1.Text,openFileDialog1.FileName,textBox2.Text,textBox3.Text);
}
public void SendFax(string DocumentName, string FileName, string RecipientName, string FaxNumber)
{
if (FaxNumber != "")
{
int response = 0;
FAXCOMLib.FaxServer faxServer = new FAXCOMLib.FaxServerClass();
try
{
faxServer.Connect("");
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
FAXCOMLib.FaxDoc faxDoc = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(FileName);
try
{
faxDoc.FaxNumber = FaxNumber;
faxDoc.RecipientName = RecipientName;
faxDoc.DisplayName = DocumentName;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
try
{
response = faxDoc.Send();
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
try
{
faxServer.Disconnect();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
}
}
private void button2_Click(object sender, EventArgs e)
{ openFileDialog1.FileName = "";
openFileDialog1.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
openFileDialog1.Filter = " doc file|*.doc";
openFileDialog1.ShowDialog();
string Filepath = "";
Filepath = openFileDialog1.FileName;
}
}
}
実際のデバイスでテストしてみませんか?何かエラーが発生していない場合は –