65 lines
1.5 KiB
C#
65 lines
1.5 KiB
C#
using BeWo.Data.Models.XRechnung;
|
|
using BeWo.Service.ServiceUtils.XRechnung;
|
|
using BS.Shared.AppSender;
|
|
using BS.Shared.DataContracts.Invoicing.XRechnung;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.IO;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace XRechnungUnitTest
|
|
{
|
|
[TestClass]
|
|
public class UnitTest1
|
|
{
|
|
public string InvoiceTest { get; set; }
|
|
public XRechnung XRechnung { get; set; }
|
|
|
|
[TestInitialize]
|
|
public void Init()
|
|
{
|
|
InvoiceTest = File.ReadAllText("invoicetest.json", System.Text.Encoding.UTF8);
|
|
XRechnung = JsonConvert.DeserializeObject<XRechnung>(InvoiceTest);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void SendRequest()
|
|
{
|
|
var response = XRechnungSender.Send(XRechnung);
|
|
|
|
Assert.IsFalse(response.HasErrors);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void SendRequestValidUrl()
|
|
{
|
|
var url = "https://app5.bewoplaner.de/service/DownloadFile.aspx?key=jhkf4589141324h6543958";
|
|
|
|
var response = XRechnungSender.Send(XRechnung, url);
|
|
|
|
Assert.IsFalse(response.HasErrors);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void SendRequestValidUrlEscape()
|
|
{
|
|
var url = Uri.EscapeDataString("https://app5.bewoplaner.de/service/DownloadFile.aspx?key=jhkf4589141324h6543958");
|
|
|
|
var response = XRechnungSender.Send(XRechnung, url);
|
|
|
|
Assert.IsFalse(response.HasErrors);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void SendRequestInvalidUrl()
|
|
{
|
|
var url = "Hallo Mike!";
|
|
|
|
var response = XRechnungSender.Send(XRechnung, url);
|
|
|
|
Assert.IsTrue(response.HasErrors);
|
|
}
|
|
}
|
|
}
|