Export Monthly Inventory
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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 MovementReportWriterTests
|
||||
{
|
||||
[OneTimeSetUp]
|
||||
public void StartUp()
|
||||
{
|
||||
HeroicAutoMapperConfigurator.LoadMapsFromAssemblyContainingTypeAndReferencedAssemblies<Inventory>();
|
||||
}
|
||||
|
||||
readonly MovementReport _movementReport = new MovementReport
|
||||
{
|
||||
Month = new DateTime(2016, 04, 1),
|
||||
Items = new[]
|
||||
{
|
||||
new MovementReportItem
|
||||
{
|
||||
InventoryType = new InventoryTypeViewModel
|
||||
{
|
||||
Name = "Beans",
|
||||
ContainerType = "#300 cans",
|
||||
Id = 1,
|
||||
Identifier = "10001",
|
||||
UnitsPerCase = 24
|
||||
},
|
||||
BeginningQuantity = 7,
|
||||
AddedQuantity = 5,
|
||||
TotalAvailableQuantity = 12,
|
||||
AdjustmentQuantity = 3,
|
||||
DistributedQuantity = 1,
|
||||
EndingQuantity = 8
|
||||
},
|
||||
new MovementReportItem
|
||||
{
|
||||
InventoryType = new InventoryTypeViewModel
|
||||
{
|
||||
Name = "Peanut Butter",
|
||||
ContainerType = "16oz jars",
|
||||
Id = 2,
|
||||
Identifier = "20001",
|
||||
UnitsPerCase = 12
|
||||
},
|
||||
BeginningQuantity = 5,
|
||||
AddedQuantity = 11,
|
||||
TotalAvailableQuantity = 16,
|
||||
AdjustmentQuantity = 0,
|
||||
DistributedQuantity = 2,
|
||||
EndingQuantity = 14
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test, Explicit]
|
||||
public void Write()
|
||||
{
|
||||
using
|
||||
(var outputFile
|
||||
= new StreamWriter(Path.Combine(@"c:\temp", "MovementReport.xlsx")))
|
||||
{
|
||||
var writer = new MovementReportWriter();
|
||||
writer.WriteStream(_movementReport, outputFile.BaseStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user