public void ProcessLineToAsset_HeaderAndLineSupplied_Processes()
        {
            // ARRANGE
            Mock<IRepository<Lookup>> m = new Mock<IRepository<Lookup>>();
            m.Setup(x => x.Single(It.IsAny<Expression<Func<Lookup, bool>>>())).Returns(
                new Lookup
                {
                    Description = "3 Years",
                    Type = new LookupType
                    {
                        Description = "WarrantyPeriod"
                    }
                }
            );

            var service = new ImportService("david");
            string[] header = {
                                  "Model",
                                  "SerialNumber",
                                  "PurchaseDate",
                                  "WarrantyPeriod",
                                  "ObsolescenseDate",
                                  "PricePaid",
                                  "Category",
                                  "LocationDescription"
                              };
            string line = "12345,LLLLLLLL1,10/03/2015,3 years,10/03/2018,100,Desktop,Room 101";
            service.LookupRepository = m.Object;

            // ACT
            ConvertedAsset convertedAsset = service.ProcessLineToAsset(header, line, 3, 1);
            Asset asset = convertedAsset.Asset;

            // ASSERT
            Assert.IsNotNull(asset);
            Assert.AreEqual("12345", asset.Model);
            Assert.AreEqual("LLLLLLLL1", asset.SerialNumber);
            Assert.AreEqual("10/03/2015", asset.PurchaseDate.Value.ToString("dd/MM/yyyy"));
            Assert.AreEqual("3 Years", asset.WarrantyPeriod.Description);
        }
        public void ProcessLineToAsset_InvalidPurchaseDate_ErrorSupplied()
        {
            // ARRANGE
            Mock<IRepository<Lookup>> m = new Mock<IRepository<Lookup>>();
            m.Setup(x => x.Single(It.IsAny<Expression<Func<Lookup, bool>>>())).Returns(
                new Lookup
                {
                    Description = "3 Years",
                    Type = new LookupType
                    {
                        Description = "WarrantyPeriod"
                    }
                }
            );

            var service = new ImportService("david");
            string[] header = {
                                  "Model",
                                  "SerialNumber",
                                  "PurchaseDate",
                                  "WarrantyPeriod",
                                  "ObsolescenceDate",
                                  "PricePaid",
                                  "Category",
                                  "LocationDescription"
                              };
            string line = "12345,LLLLLLLL1,30/30/2015,3 years,july july aug,money,Desktop,Room 101";
            service.LookupRepository = m.Object;

            // ACT
            ConvertedAsset convertedAsset = service.ProcessLineToAsset(header, line, 3, 1);
            Asset asset = convertedAsset.Asset;

            // ASSERT
            Assert.IsNotNull(asset);
            Assert.AreEqual("12345", asset.Model);
            Assert.AreEqual("LLLLLLLL1", asset.SerialNumber);
            Assert.AreEqual("3 Years", asset.WarrantyPeriod.Description);
            Assert.AreEqual(3, convertedAsset.Errors.Count);
            Assert.AreEqual(
                string.Format(HIResources.Strings.ImportError_PurchaseDate, 1, "30/30/2015"),
                convertedAsset.Errors[0]);
            Assert.AreEqual(
                string.Format(HIResources.Strings.ImportError_ObsolescenseDate, 1, "july july aug"),
                convertedAsset.Errors[1]);
            Assert.AreEqual(string.Format(HIResources.Strings.ImportError_PricePaid, 1, "money"),
                convertedAsset.Errors[2]);
        }