63 lines
1.3 KiB
C#
63 lines
1.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using Heroic.AutoMapper;
|
|
using InventoryTraker.Web.Core;
|
|
using InventoryTraker.Web.Models;
|
|
using InventoryTraker.Web.Utilities;
|
|
using NUnit.Framework;
|
|
|
|
namespace InventoryTraker.Web.Tests.Utilities
|
|
{
|
|
[TestFixture]
|
|
public class DistributionReportWriterTests
|
|
{
|
|
private readonly DistributionReport[] _distributionReports =
|
|
{
|
|
new DistributionReport
|
|
{
|
|
Destination = "First City",
|
|
Date = new DateTime(2016, 1, 1),
|
|
Transactions = new[]
|
|
{
|
|
new TransactionViewModel
|
|
{
|
|
Name = "Beans",
|
|
ContainerType = "#300 cans",
|
|
UnitsPerCase = 24,
|
|
Destination = "First City",
|
|
RemovedQuantity = 3
|
|
}
|
|
}
|
|
},
|
|
new DistributionReport
|
|
{
|
|
Destination = "Second City",
|
|
Date = new DateTime(2016, 2, 1),
|
|
Transactions = new[]
|
|
{
|
|
new TransactionViewModel
|
|
{
|
|
Name = "Peanut Butter",
|
|
ContainerType = "Jars",
|
|
UnitsPerCase = 24,
|
|
Destination = "Second City",
|
|
RemovedQuantity = 4
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
[Test, Explicit]
|
|
public void Write()
|
|
{
|
|
using
|
|
(var outputFile
|
|
= new StreamWriter(Path.Combine(@"c:\temp", "DistributionReport.xlsx")))
|
|
{
|
|
var writer = new DistributionReportWriter();
|
|
writer.WriteStream(_distributionReports, outputFile.BaseStream);
|
|
}
|
|
}
|
|
}
|
|
}
|