Exemplo n.º 1
0
        protected long AssertCompress(string fileName, bool resultIsSmaller, Func <string, bool> action)
        {
            using (TemporaryFile tempFile = new TemporaryFile(fileName))
            {
                long before = tempFile.Length;

                bool result = action(tempFile.FullName);

                tempFile.Refresh();
                long after = tempFile.Length;

                Assert.AreEqual(resultIsSmaller, result);

                if (resultIsSmaller)
                {
                    Assert.IsTrue(after < before, "{0} is not smaller than {1}", after, before);
                }
                else
                {
                    Assert.AreEqual(before, after);
                }

                return(after);
            }
        }