Box modifications

This commit is contained in:
2016-10-18 11:10:01 -04:00
parent 3caf0bd766
commit fdc34c4ef7
109 changed files with 11033 additions and 2442 deletions
@@ -1,69 +0,0 @@
using System;
using System.IO;
using AutoMapper;
using InventoryTraker.Web.Models;
using InventoryTraker.Web.Utilities;
using NUnit.Framework;
namespace InventoryTraker.Web.Tests.Utilities
{
[TestFixture]
public class DistributionReportWriterTests
{
private IMapper _mapper;
[OneTimeSetUp]
public void StartUp()
{
_mapper = AutoMapperConfig.Config.CreateMapper();
}
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(_mapper);
writer.WriteStream(_distributionReports, outputFile.BaseStream);
}
}
}
}
@@ -0,0 +1,44 @@
using System;
using System.IO;
using InventoryTraker.Web.Utilities;
using NUnit.Framework;
namespace InventoryTraker.Web.Tests.Utilities
{
[TestFixture]
public class InventoryParserTests
{
private readonly string _documentFolder =
AppDomain.CurrentDomain.BaseDirectory + @"\Utilities\Documents\";
[Test]
public void Parse()
{
var fileInfo = new FileInfo(Path.Combine(_documentFolder, "InventoryData.xlsx"));
var parser = new InventoryParser(fileInfo);
var forms = parser.Parse();
foreach (var form in forms)
{
Console.WriteLine($"{form.Id} {form.ProgramName} {form.ShredReadyDate}");
}
}
[Test]
public void Parse_NoExtension()
{
var fileInfo = new FileInfo(Path.Combine(_documentFolder, "InventoryData-NoExtension"));
var parser = new InventoryParser(fileInfo);
var forms = parser.Parse();
foreach (var form in forms)
{
Console.WriteLine($"{form.Id} {form.ProgramName} {form.ShredReadyDate}");
}
}
}
}
@@ -13,16 +13,11 @@ namespace InventoryTraker.Web.Tests.Utilities
{
new InventoryViewModel
{
Name = "Beans",
ContainerType = "#300 cans",
UnitsPerCase = 24,
Id = "34634584",
AddedDate = new DateTime(2015,3,1),
ExpirationDate = new DateTime(2017,4,1),
Quantity = 20,
ShredReadyDate = new DateTime(2017,4,1),
Quantity = 0,
Memo = "my memo",
PricePerCase = 12.12M,
WeightPerCase = 20.1,
}
};
@@ -1,29 +0,0 @@
using System;
using System.IO;
using InventoryTraker.Web.Utilities;
using NUnit.Framework;
namespace InventoryTraker.Web.Tests.Utilities
{
[TestFixture]
public class InventoryTypeParserTests
{
private readonly string _documentFolder =
AppDomain.CurrentDomain.BaseDirectory + @"\Utilities\Documents\";
[Test]
public void Parse()
{
var fileInfo = new FileInfo(Path.Combine(_documentFolder, "InventoryTypeData.xlsx"));
var parser = new InventoryTypeParser(fileInfo);
var inventoryTypes = parser.Parse();
foreach (var inventoryType in inventoryTypes)
{
Console.WriteLine($"{inventoryType.Identifier} {inventoryType.Name} {inventoryType.PricePerCase}");
}
}
}
}
@@ -1,76 +0,0 @@
using System;
using System.IO;
using AutoMapper;
using InventoryTraker.Web.Models;
using InventoryTraker.Web.Utilities;
using NUnit.Framework;
namespace InventoryTraker.Web.Tests.Utilities
{
[TestFixture]
public class MovementReportWriterTests
{
private IMapper _mapper;
[OneTimeSetUp]
public void StartUp()
{
_mapper = AutoMapperConfig.Config.CreateMapper();
}
private 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(_mapper);
writer.WriteStream(_movementReport, outputFile.BaseStream);
}
}
}
}