-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed serialization when serializing from BaseRequestBody
- Loading branch information
Showing
4 changed files
with
50 additions
and
7 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
src/MadWare.Furs.UnitTest/TestDigitalSignatureProviders.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using MadWare.Furs.Encryption; | ||
using MadWare.Furs.Requests; | ||
using MadWare.Furs.Serialization; | ||
using MadWare.Furs.ZOI; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace MadWare.Furs.UnitTest | ||
{ | ||
public class TestDigitalSignatureProviders | ||
{ | ||
|
||
public static IEnumerable<object[]> TestDataCalculateSigInvoice() | ||
{ | ||
return new[] { | ||
new object[] { | ||
new Envelope<BaseRequestBody> { Body = new InvoiceRequestBody { InvoiceRequest = new Models.Invoice.InvoiceRequest { | ||
Invoice = new Models.Invoice.Invoice { | ||
TaxNumber = "12345678", | ||
IssueDateTime = new DateTime(2016, 3, 20, 20, 0, 0), | ||
InvoiceIdentifier = new Models.Invoice.InvoiceIdentifier { BusinessPremiseID = "PP1", ElectronicDeviceID = "EN1", InvoiceNumber = "123" }, | ||
InvoiceAmount = 12.34M | ||
} } } } | ||
} | ||
}; | ||
} | ||
|
||
[Theory] | ||
[MemberData("TestDataCalculateSigInvoice")] | ||
public void TestDigitalSignatureXmlInvoice<T>(Envelope<BaseRequestBody> e) | ||
{ | ||
IEnvelopeSerializer s = new XmlEnvelopeSerializer(); | ||
string payload = s.SerializeEnvelope(e); | ||
|
||
var cert = new System.Security.Cryptography.X509Certificates.X509Certificate2(@"E:\Programiranje\MadWare.Furs\src\MadWare.Furs.UnitTest\10442529-1.p12", "SAMR6ADL8IE6"); | ||
IDigitalSignatureProvider sig = new CertXmlDigitalSignatureProvider(cert); | ||
|
||
string signedPayload = sig.Sign(payload, e); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters