diff options
author | Serghei Cebotari <serghei@cebotari.ru> | 2023-10-17 21:22:42 +0300 |
---|---|---|
committer | Serghei Cebotari <serghei@cebotari.ru> | 2023-10-17 21:22:42 +0300 |
commit | 199540e530d0605002524fb9981cbb74c4f137cd (patch) | |
tree | db6741cea2da537926c81b53879c81c0a502fba4 /RhSolutions.Tests | |
parent | e462add7f3e24a5bcdf839ceccde7eafca9b7060 (diff) |
Revert "Move Price List Validation to separate static class"
This reverts commit e14d714811df1cc5d48543940042fd7481a86970.
Diffstat (limited to 'RhSolutions.Tests')
-rw-r--r-- | RhSolutions.Tests/CanDoGuess.cs | 4 | ||||
-rw-r--r-- | RhSolutions.Tests/CanFillSleeves.cs | 1 | ||||
-rw-r--r-- | RhSolutions.Tests/CanReadProducts.cs | 2 | ||||
-rw-r--r-- | RhSolutions.Tests/CanWriteProducts.cs | 10 | ||||
-rw-r--r-- | RhSolutions.Tests/RealPricelistTest.cs | 2 | ||||
-rw-r--r-- | RhSolutions.Tests/WorkbookValidationTests.cs | 11 |
6 files changed, 5 insertions, 25 deletions
diff --git a/RhSolutions.Tests/CanDoGuess.cs b/RhSolutions.Tests/CanDoGuess.cs index a0ac882..a43c92e 100644 --- a/RhSolutions.Tests/CanDoGuess.cs +++ b/RhSolutions.Tests/CanDoGuess.cs @@ -23,13 +23,11 @@ public class CanDoGuess : IDisposable public void CanWriteMultiplyRows() { Worksheet sourceSheet = Util.Workbook.Worksheets[1]; - sourceSheet.Validate(); RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationGuess.xlsx")); var products = _guessReader.ReadProducts(new[] { sourceSheet }); var _writer = new NewPriceWriter(Util.Application, RhSolutionsAddIn.Configuration); _writer.WriteProducts(products); Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; - targetSheet.Validate(); var targetProducts = _reader.ReadProducts(new[] { targetSheet }); Assert.Equal("TestSpecificationGuess", products.First().Item1); @@ -42,13 +40,11 @@ public class CanDoGuess : IDisposable public void CanWriteOneRow() { Worksheet sourceSheet = Util.Workbook.Worksheets[1]; - sourceSheet.Validate(); RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationGuessOneRow.xlsx")); var products = _guessReader.ReadProducts(new[] { sourceSheet }); var _writer = new NewPriceWriter(Util.Application, RhSolutionsAddIn.Configuration); _writer.WriteProducts(products); Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; - targetSheet.Validate(); var targetProducts = _reader.ReadProducts(new[] { targetSheet }); Assert.Equal("TestSpecificationGuessOneRow", products.First().Item1); diff --git a/RhSolutions.Tests/CanFillSleeves.cs b/RhSolutions.Tests/CanFillSleeves.cs index aa0aa5d..aedad09 100644 --- a/RhSolutions.Tests/CanFillSleeves.cs +++ b/RhSolutions.Tests/CanFillSleeves.cs @@ -24,7 +24,6 @@ public class CanFillSleeves : IDisposable [ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationSleeves.xlsx")] public void CanCalculateSleeves() { - _worksheet.Validate(); var products = _reader.ReadProducts(new[] { _worksheet }); var sleeves = _calculator.CalculateSleeves(products.First().Item2); _writer.WriteProducts(sleeves); diff --git a/RhSolutions.Tests/CanReadProducts.cs b/RhSolutions.Tests/CanReadProducts.cs index 745c243..e796da0 100644 --- a/RhSolutions.Tests/CanReadProducts.cs +++ b/RhSolutions.Tests/CanReadProducts.cs @@ -22,7 +22,6 @@ public class CanReadProducts : IDisposable public void CanReadRange() { Worksheet worksheet = _testWorkbook.Sheets[1]; - worksheet.Validate(); worksheet.Range["A1"].Value = "11600011001"; worksheet.Range["A2"].Value = "11600011001"; worksheet.Range["A3"].Value = "160002-001"; @@ -50,7 +49,6 @@ public class CanReadProducts : IDisposable public void CanReadWorkbook() { Worksheet worksheet = Util.Workbook.Worksheets[1]; - worksheet.Validate(); var result = _reader.ReadProducts(new[] { worksheet }); Assert.NotNull(result); Assert.NotEmpty(result); diff --git a/RhSolutions.Tests/CanWriteProducts.cs b/RhSolutions.Tests/CanWriteProducts.cs index 7c72903..50ce662 100644 --- a/RhSolutions.Tests/CanWriteProducts.cs +++ b/RhSolutions.Tests/CanWriteProducts.cs @@ -21,13 +21,11 @@ public class CanWriteProducts : IDisposable public void CanWriteSingle() { Worksheet sourceSheet = Util.Workbook.Worksheets[1]; - sourceSheet.Validate(); RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecification.xlsx")); var products = _reader.ReadProducts(new[] { sourceSheet }); var _writer = new NewPriceWriter(Util.Application, RhSolutionsAddIn.Configuration); _writer.WriteProducts(products); Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; - targetSheet.Validate(); var targetProducts = _reader.ReadProducts(new[] { targetSheet }); Assert.Equal("TestSpecification", products.First().Item1); @@ -40,13 +38,11 @@ public class CanWriteProducts : IDisposable public void CanWriteMultipleProductLines() { Worksheet sourceSheet = Util.Workbook.Worksheets[1]; - sourceSheet.Validate(); RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationMultipleProductLines.xlsx")); var products = _reader.ReadProducts(new[] { sourceSheet }); var _writer = new NewPriceWriter(Util.Application, RhSolutionsAddIn.Configuration); _writer.WriteProducts(products); Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; - targetSheet.Validate(); var targetProducts = _reader.ReadProducts(new[] { targetSheet }); Assert.Equal("TestSpecificationMultipleProductLines", products.First().Item1); @@ -59,13 +55,11 @@ public class CanWriteProducts : IDisposable public void CanWriteNotFound() { Worksheet sourceSheet = Util.Workbook.Worksheets[1]; - sourceSheet.Validate(); RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationNotFound.xlsx")); var products = _reader.ReadProducts(new[] { sourceSheet }); var _writer = new NewPriceWriter(Util.Application, RhSolutionsAddIn.Configuration); _writer.WriteProducts(products); Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; - targetSheet.Validate(); Assert.Equal("???", targetSheet.Range["B4"].Value2); Assert.Contains("Молот Тора", targetSheet.Range["C4"].Value2); @@ -76,13 +70,11 @@ public class CanWriteProducts : IDisposable public void CanWriteReplaced() { Worksheet sourceSheet = Util.Workbook.Worksheets[1]; - sourceSheet.Validate(); RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationReplaced.xlsx")); var products = _reader.ReadProducts(new[] { sourceSheet }); var _writer = new NewPriceWriter(Util.Application, RhSolutionsAddIn.Configuration); _writer.WriteProducts(products); Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; - targetSheet.Validate(); var targetProducts = _reader.ReadProducts(new[] { targetSheet }); Assert.Equal("TestSpecificationReplaced", products.First().Item1); @@ -100,13 +92,11 @@ public class CanWriteProducts : IDisposable public void CanWriteNewVariant() { Worksheet sourceSheet = Util.Workbook.Worksheets[1]; - sourceSheet.Validate(); RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationNewVariant.xlsx")); var products = _reader.ReadProducts(new[] { sourceSheet }); var _writer = new NewPriceWriter(Util.Application, RhSolutionsAddIn.Configuration); _writer.WriteProducts(products); Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; - targetSheet.Validate(); var targetProducts = _reader.ReadProducts(new[] { targetSheet }); Assert.Equal("TestSpecificationNewVariant", products.First().Item1); diff --git a/RhSolutions.Tests/RealPricelistTest.cs b/RhSolutions.Tests/RealPricelistTest.cs index cb99908..9ff3a25 100644 --- a/RhSolutions.Tests/RealPricelistTest.cs +++ b/RhSolutions.Tests/RealPricelistTest.cs @@ -21,13 +21,11 @@ public class RealPricelistTest : IDisposable public void CanWrite() { Worksheet sourceSheet = Util.Workbook.Worksheets[1]; - sourceSheet.Validate(); RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\RealTargetSpecification.xlsx")); var products = _reader.ReadProducts(new[] { sourceSheet }); var _writer = new NewPriceWriter(Util.Application, RhSolutionsAddIn.Configuration); _writer.WriteProducts(products); Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; - targetSheet.Validate(); targetSheet.Range["A1"].Formula = "=SUM(H:H)"; Assert.Equal("RealTestSpecification", products.First().Item1); diff --git a/RhSolutions.Tests/WorkbookValidationTests.cs b/RhSolutions.Tests/WorkbookValidationTests.cs index 5a6700a..f5b338a 100644 --- a/RhSolutions.Tests/WorkbookValidationTests.cs +++ b/RhSolutions.Tests/WorkbookValidationTests.cs @@ -1,4 +1,5 @@ using RhSolutions.AddIn; +using RhSolutions.Tools; namespace RhSolutions.Tests; @@ -17,17 +18,15 @@ public class WorkbookValidationTests : IDisposable [ExcelFact(Workbook = @"..\..\..\TestWorkbooks\EmptyTestTable.xlsx")] public void WorksheetIsCorrect() { - Worksheet ws = Util.Workbook.Sheets[1]; - ws.Validate(); - Assert.True(WorksheetValidator.IsValid()); + Worksheet worksheet = Util.Workbook.Sheets[1]; + Assert.True(worksheet.IsValidSource()); } [ExcelFact(Workbook = @"..\..\..\TestWorkbooks\EmptyWorkbook.xlsx")] public void EmptyWorkbookIsNotCorrect() { - Worksheet ws = Util.Workbook.Sheets[1]; - ws.Validate(); - Assert.False(WorksheetValidator.IsValid()); + Worksheet worksheet = Util.Workbook.Sheets[1]; + Assert.False(worksheet.IsValidSource()); } public void Dispose() |