From 16b5ddedb1c89c0bdad56eab384f8e6cecaf2107 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Tue, 23 May 2023 07:07:16 +0300 Subject: Rename Magic to Guess --- RhSolutions.Tests/CanDoGuess.cs | 42 ++++++++++++++++++++ RhSolutions.Tests/CanDoMagic.cs | 44 --------------------- .../TestWorkbooks/TargetSpecificationGuess.xlsx | Bin 0 -> 11597 bytes .../TestWorkbooks/TargetSpecificationMagic.xlsx | Bin 11597 -> 0 bytes .../TestWorkbooks/TestSpecificationGuess.xlsx | Bin 0 -> 11669 bytes .../TestWorkbooks/TestSpecificationMagic.xlsx | Bin 11669 -> 0 bytes 6 files changed, 42 insertions(+), 44 deletions(-) create mode 100644 RhSolutions.Tests/CanDoGuess.cs delete mode 100644 RhSolutions.Tests/CanDoMagic.cs create mode 100644 RhSolutions.Tests/TestWorkbooks/TargetSpecificationGuess.xlsx delete mode 100644 RhSolutions.Tests/TestWorkbooks/TargetSpecificationMagic.xlsx create mode 100644 RhSolutions.Tests/TestWorkbooks/TestSpecificationGuess.xlsx delete mode 100644 RhSolutions.Tests/TestWorkbooks/TestSpecificationMagic.xlsx (limited to 'RhSolutions.Tests') diff --git a/RhSolutions.Tests/CanDoGuess.cs b/RhSolutions.Tests/CanDoGuess.cs new file mode 100644 index 0000000..c801af7 --- /dev/null +++ b/RhSolutions.Tests/CanDoGuess.cs @@ -0,0 +1,42 @@ +using Microsoft.Extensions.DependencyInjection; +using RhSolutions.AddIn; +using System.IO; + +namespace RhSolutions.Tests; + +[ExcelTestSettings(OutOfProcess = true)] +public class CanDoGuess : IDisposable +{ + private RhSolutionsAddIn _addIn; + private IReader _reader; + + public CanDoGuess() + { + _addIn = new(); + _addIn.AutoOpen(); + _reader = new GuessReader(Util.Application); + } + + [ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationGuess.xlsx")] + public void CanWrite() + { + Worksheet sourceSheet = Util.Workbook.Worksheets[1]; + RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationGuess.xlsx")); + var products = _reader.ReadProducts(new[] { sourceSheet }); + var _writer = new ExcelWriter(Util.Application, RhSolutionsAddIn.Configuration); + _writer.WriteProducts(products); + Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; + var targetProducts = _reader.ReadProducts(new[] { targetSheet }); + + Assert.Equal("TestSpecificationGuess", products.First().Item1); + Assert.Equal("TargetSpecificationGuess", targetProducts.First().Item1); + Assert.Equal(products.First().Item2.Count(), targetProducts.First().Item2.Count()); + Assert.Equal(products.First().Item2.Values.Sum(), targetProducts.First().Item2.Values.Sum()); + } + + public void Dispose() + { + _addIn.AutoClose(); + Util.Application.ActiveWindow.Close(SaveChanges: false); + } +} diff --git a/RhSolutions.Tests/CanDoMagic.cs b/RhSolutions.Tests/CanDoMagic.cs deleted file mode 100644 index d3a0bf9..0000000 --- a/RhSolutions.Tests/CanDoMagic.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using RhSolutions.AddIn; -using System.IO; - -namespace RhSolutions.Tests; - -[ExcelTestSettings(OutOfProcess = true)] -public class CanDoMagic : IDisposable -{ - private RhSolutionsAddIn _addIn; - //private ReaderFactory _readerFactory; - private IReader _reader; - - public CanDoMagic() - { - _addIn = new(); - _addIn.AutoOpen(); - //_readerFactory = RhSolutionsAddIn.ServiceProvider.GetRequiredService(); - _reader = new MagicReader(Util.Application); - } - - [ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationMagic.xlsx")] - public void CanWrite() - { - Worksheet sourceSheet = Util.Workbook.Worksheets[1]; - RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationMagic.xlsx")); - var products = _reader.ReadProducts(new[] { sourceSheet }); - var _writer = new ExcelWriter(Util.Application, RhSolutionsAddIn.Configuration); - _writer.WriteProducts(products); - Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet; - var targetProducts = _reader.ReadProducts(new[] { targetSheet }); - - Assert.Equal("TestSpecificationMagic", products.First().Item1); - Assert.Equal("TargetSpecificationMagic", targetProducts.First().Item1); - Assert.Equal(products.First().Item2.Count(), targetProducts.First().Item2.Count()); - Assert.Equal(products.First().Item2.Values.Sum(), targetProducts.First().Item2.Values.Sum()); - } - - public void Dispose() - { - _addIn.AutoClose(); - Util.Application.ActiveWindow.Close(SaveChanges: false); - } -} diff --git a/RhSolutions.Tests/TestWorkbooks/TargetSpecificationGuess.xlsx b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationGuess.xlsx new file mode 100644 index 0000000..e7bae5f Binary files /dev/null and b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationGuess.xlsx differ diff --git a/RhSolutions.Tests/TestWorkbooks/TargetSpecificationMagic.xlsx b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationMagic.xlsx deleted file mode 100644 index e7bae5f..0000000 Binary files a/RhSolutions.Tests/TestWorkbooks/TargetSpecificationMagic.xlsx and /dev/null differ diff --git a/RhSolutions.Tests/TestWorkbooks/TestSpecificationGuess.xlsx b/RhSolutions.Tests/TestWorkbooks/TestSpecificationGuess.xlsx new file mode 100644 index 0000000..d268c3e Binary files /dev/null and b/RhSolutions.Tests/TestWorkbooks/TestSpecificationGuess.xlsx differ diff --git a/RhSolutions.Tests/TestWorkbooks/TestSpecificationMagic.xlsx b/RhSolutions.Tests/TestWorkbooks/TestSpecificationMagic.xlsx deleted file mode 100644 index d268c3e..0000000 Binary files a/RhSolutions.Tests/TestWorkbooks/TestSpecificationMagic.xlsx and /dev/null differ -- cgit v1.2.3