Export Distribution report

This commit is contained in:
2016-09-22 08:49:24 -04:00
parent 206a3f2def
commit 02555eba7e
11 changed files with 216 additions and 21 deletions
@@ -0,0 +1,68 @@
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
{
[OneTimeSetUp]
public void StartUp()
{
HeroicAutoMapperConfigurator.LoadMapsFromAssemblyContainingTypeAndReferencedAssemblies<Inventory>();
}
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);
}
}
}
}
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
@@ -18,7 +17,8 @@ namespace InventoryTraker.Web.Tests.Utilities
HeroicAutoMapperConfigurator.LoadMapsFromAssemblyContainingTypeAndReferencedAssemblies<Inventory>();
}
readonly MovementReport _movementReport = new MovementReport
private readonly MovementReport _movementReport
= new MovementReport
{
Month = new DateTime(2016, 04, 1),
Items = new[]