-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4acf00d
commit 661ccf1
Showing
10 changed files
with
270 additions
and
37 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,7 +144,7 @@ public void Test_Find() | |
} | ||
|
||
[TestMethod] | ||
public void Invoice_DueDate() | ||
public void Test_DueDate() | ||
{ | ||
#region Arrange | ||
var tmpCustomer = new CustomerConnector().Create(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis" }); | ||
|
@@ -189,11 +189,15 @@ public void Invoice_DueDate() | |
} | ||
|
||
[TestMethod] | ||
public void Invoice_Print() | ||
public void Test_Print() | ||
{ | ||
#region Arrange | ||
var tmpCustomer = new CustomerConnector().Create(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis" }); | ||
var tmpArticle = new ArticleConnector().Create(new Article() { Description = "TmpArticle", Type = ArticleType.STOCK, PurchasePrice = 100 }); | ||
var cc = new CustomerConnector(); | ||
var ac = new ArticleConnector(); | ||
var tmpCustomer = cc.Create(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis" }); | ||
var tmpArticle = ac.Create(new Article() { Description = "TmpArticle", Type = ArticleType.STOCK, PurchasePrice = 100 }); | ||
MyAssert.HasNoError(cc); | ||
MyAssert.HasNoError(ac); | ||
#endregion Arrange | ||
|
||
IInvoiceConnector connector = new InvoiceConnector(); | ||
|
@@ -219,7 +223,55 @@ public void Invoice_Print() | |
|
||
var fileData = connector.Print(createdInvoice.DocumentNumber); | ||
MyAssert.HasNoError(connector); | ||
Assert.IsTrue(fileData.Length > 10000); | ||
MyAssert.IsPDF(fileData); | ||
|
||
#region Delete arranged resources | ||
new CustomerConnector().Delete(tmpCustomer.CustomerNumber); | ||
new ArticleConnector().Delete(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
|
||
[TestMethod] | ||
public void Test_Email() | ||
{ | ||
#region Arrange | ||
var cc = new CustomerConnector(); | ||
var ac = new ArticleConnector(); | ||
var tmpCustomer = cc.Create(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis", Email = "[email protected]" }); | ||
var tmpArticle = ac.Create(new Article() { Description = "TmpArticle", Type = ArticleType.STOCK, PurchasePrice = 100 }); | ||
MyAssert.HasNoError(cc); | ||
MyAssert.HasNoError(ac); | ||
#endregion Arrange | ||
|
||
IInvoiceConnector connector = new InvoiceConnector(); | ||
|
||
var newInvoice = new Invoice() | ||
{ | ||
CustomerNumber = tmpCustomer.CustomerNumber, | ||
InvoiceDate = new DateTime(2019, 1, 20), //"2019-01-20", | ||
DueDate = new DateTime(2019, 2, 20), //"2019-02-20", | ||
InvoiceType = InvoiceType.CASHINVOICE, | ||
PaymentWay = PaymentWay.CASH, | ||
Comments = "Testing invoice email feature", | ||
InvoiceRows = new List<InvoiceRow>() | ||
{ | ||
new InvoiceRow(){ ArticleNumber = tmpArticle.ArticleNumber, DeliveredQuantity = 10, Price = 100}, | ||
new InvoiceRow(){ ArticleNumber = tmpArticle.ArticleNumber, DeliveredQuantity = 20, Price = 100}, | ||
new InvoiceRow(){ ArticleNumber = tmpArticle.ArticleNumber, DeliveredQuantity = 15, Price = 100} | ||
} | ||
}; | ||
|
||
var createdInvoice = connector.Create(newInvoice); | ||
MyAssert.HasNoError(connector); | ||
|
||
var emailedInvoice = connector.Email(createdInvoice.DocumentNumber); | ||
MyAssert.HasNoError(connector); | ||
Assert.AreEqual(emailedInvoice.DocumentNumber, createdInvoice.DocumentNumber); | ||
|
||
#region Delete arranged resources | ||
new CustomerConnector().Delete(tmpCustomer.CustomerNumber); | ||
new ArticleConnector().Delete(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,5 +136,75 @@ public void Test_Find() | |
new ArticleConnector().Delete(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
|
||
[TestMethod] | ||
public void Test_Print() | ||
{ | ||
#region Arrange | ||
var tmpCustomer = new CustomerConnector().Create(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis" }); | ||
var tmpArticle = new ArticleConnector().Create(new Article() { Description = "TmpArticle", Type = ArticleType.STOCK, PurchasePrice = 100 }); | ||
#endregion Arrange | ||
|
||
IOfferConnector connector = new OfferConnector(); | ||
var newOffer = new Offer() | ||
{ | ||
Comments = "TestOrder", | ||
CustomerNumber = tmpCustomer.CustomerNumber, | ||
OfferDate = new DateTime(2019, 1, 20), //"2019-01-20", | ||
OfferRows = new List<OfferRow>() | ||
{ | ||
new OfferRow(){ ArticleNumber = tmpArticle.ArticleNumber, Quantity = 10}, | ||
new OfferRow(){ ArticleNumber = tmpArticle.ArticleNumber, Quantity = 20}, | ||
new OfferRow(){ ArticleNumber = tmpArticle.ArticleNumber, Quantity = 15} | ||
} | ||
}; | ||
|
||
var createdOffer = connector.Create(newOffer); | ||
MyAssert.HasNoError(connector); | ||
|
||
var fileData = connector.Print(createdOffer.DocumentNumber); | ||
MyAssert.HasNoError(connector); | ||
MyAssert.IsPDF(fileData); | ||
|
||
#region Delete arranged resources | ||
new CustomerConnector().Delete(tmpCustomer.CustomerNumber); | ||
new ArticleConnector().Delete(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
|
||
[TestMethod] | ||
public void Test_Email() | ||
{ | ||
#region Arrange | ||
var tmpCustomer = new CustomerConnector().Create(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis", Email = "[email protected]"}); | ||
var tmpArticle = new ArticleConnector().Create(new Article() { Description = "TmpArticle", Type = ArticleType.STOCK, PurchasePrice = 100 }); | ||
#endregion Arrange | ||
|
||
IOfferConnector connector = new OfferConnector(); | ||
var newOffer = new Offer() | ||
{ | ||
Comments = "TestOrder", | ||
CustomerNumber = tmpCustomer.CustomerNumber, | ||
OfferDate = new DateTime(2019, 1, 20), //"2019-01-20", | ||
OfferRows = new List<OfferRow>() | ||
{ | ||
new OfferRow(){ ArticleNumber = tmpArticle.ArticleNumber, Quantity = 10}, | ||
new OfferRow(){ ArticleNumber = tmpArticle.ArticleNumber, Quantity = 20}, | ||
new OfferRow(){ ArticleNumber = tmpArticle.ArticleNumber, Quantity = 15} | ||
} | ||
}; | ||
|
||
var createdOffer = connector.Create(newOffer); | ||
MyAssert.HasNoError(connector); | ||
|
||
var emailedInvoice = connector.Email(createdOffer.DocumentNumber); | ||
MyAssert.HasNoError(connector); | ||
Assert.AreEqual(emailedInvoice.DocumentNumber, createdOffer.DocumentNumber); | ||
|
||
#region Delete arranged resources | ||
new CustomerConnector().Delete(tmpCustomer.CustomerNumber); | ||
new ArticleConnector().Delete(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -136,5 +136,75 @@ public void Test_Find() | |
new ArticleConnector().Delete(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
|
||
[TestMethod] | ||
public void Test_Print() | ||
{ | ||
#region Arrange | ||
var tmpCustomer = new CustomerConnector().Create(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis" }); | ||
var tmpArticle = new ArticleConnector().Create(new Article() { Description = "TmpArticle", Type = ArticleType.STOCK, PurchasePrice = 100 }); | ||
#endregion Arrange | ||
|
||
IOrderConnector connector = new OrderConnector(); | ||
var newOrder = new Order() | ||
{ | ||
Comments = "TestOrder", | ||
CustomerNumber = tmpCustomer.CustomerNumber, | ||
OrderDate = new DateTime(2019, 1, 20), //"2019-01-20", | ||
OrderRows = new List<OrderRow>() | ||
{ | ||
new OrderRow(){ ArticleNumber = tmpArticle.ArticleNumber, OrderedQuantity = 20, DeliveredQuantity = 10}, | ||
new OrderRow(){ ArticleNumber = tmpArticle.ArticleNumber, OrderedQuantity = 20, DeliveredQuantity = 20}, | ||
new OrderRow(){ ArticleNumber = tmpArticle.ArticleNumber, OrderedQuantity = 20, DeliveredQuantity = 15} | ||
} | ||
}; | ||
|
||
var createdOrder = connector.Create(newOrder); | ||
MyAssert.HasNoError(connector); | ||
|
||
var fileData = connector.Print(createdOrder.DocumentNumber); | ||
MyAssert.HasNoError(connector); | ||
MyAssert.IsPDF(fileData); | ||
|
||
#region Delete arranged resources | ||
new CustomerConnector().Delete(tmpCustomer.CustomerNumber); | ||
new ArticleConnector().Delete(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
|
||
[TestMethod] | ||
public void Test_Email() | ||
{ | ||
#region Arrange | ||
var tmpCustomer = new CustomerConnector().Create(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis", Email = "[email protected]" }); | ||
var tmpArticle = new ArticleConnector().Create(new Article() { Description = "TmpArticle", Type = ArticleType.STOCK, PurchasePrice = 100 }); | ||
#endregion Arrange | ||
|
||
IOrderConnector connector = new OrderConnector(); | ||
var newOrder = new Order() | ||
{ | ||
Comments = "TestOrder", | ||
CustomerNumber = tmpCustomer.CustomerNumber, | ||
OrderDate = new DateTime(2019, 1, 20), //"2019-01-20", | ||
OrderRows = new List<OrderRow>() | ||
{ | ||
new OrderRow(){ ArticleNumber = tmpArticle.ArticleNumber, OrderedQuantity = 20, DeliveredQuantity = 10}, | ||
new OrderRow(){ ArticleNumber = tmpArticle.ArticleNumber, OrderedQuantity = 20, DeliveredQuantity = 20}, | ||
new OrderRow(){ ArticleNumber = tmpArticle.ArticleNumber, OrderedQuantity = 20, DeliveredQuantity = 15} | ||
} | ||
}; | ||
|
||
var createdOrder = connector.Create(newOrder); | ||
MyAssert.HasNoError(connector); | ||
|
||
var emailedInvoice = connector.Email(createdOrder.DocumentNumber); | ||
MyAssert.HasNoError(connector); | ||
Assert.AreEqual(emailedInvoice.DocumentNumber, createdOrder.DocumentNumber); | ||
|
||
#region Delete arranged resources | ||
new CustomerConnector().Delete(tmpCustomer.CustomerNumber); | ||
new ArticleConnector().Delete(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.