Ejemplo n.º 1
0
        public void op_Include_Operation()
        {
            try
            {
                using (var temp = new TempDirectory())
                {
                    Recovery.MasterDirectory = temp.Info.ToDirectory("Recovery");
                    var operation = new Operation(Guid.NewGuid())
                    {
                        Info = Guid.NewGuid().ToString()
                    };

                    Recovery.Include(operation);

                    var expected = Recovery.ItemFile(operation).FullName;
                    foreach (var actual in Recovery.MasterFile(operation).Lines())
                    {
                        Assert.Equal(expected, actual);
                    }
                }
            }
            finally
            {
                Recovery.MasterDirectory = null;
            }
        }
Ejemplo n.º 2
0
        public void op_Exclude_Operations_bool()
        {
            try
            {
                using (var temp = new TempDirectory())
                {
                    var resourceManager = Guid.NewGuid();
                    Recovery.MasterDirectory = temp.Info.ToDirectory("Recovery");
                    var operation1 = new Operation(resourceManager)
                    {
                        Info = Guid.NewGuid().ToString()
                    };

                    Recovery.Include(operation1);

                    var operation2 = new Operation(resourceManager)
                    {
                        Info = Guid.NewGuid().ToString()
                    };

                    Recovery.Include(operation2);
                    Recovery.Exclude(operation1, true);
                    var expected = Recovery.ItemFile(operation1, "Commit").FullName;
                    foreach (var actual in Recovery.MasterFile(operation1).Lines())
                    {
                        Assert.NotEqual(expected, actual);
                    }
                }
            }
            finally
            {
                Recovery.MasterDirectory = null;
            }
        }
Ejemplo n.º 3
0
        public void op_Include_Operations()
        {
            try
            {
                using (var temp = new TempDirectory())
                {
                    var resourceManager = Guid.NewGuid();
                    Recovery.MasterDirectory = temp.Info.ToDirectory("Recovery");
                    var operation = new Operation(resourceManager)
                    {
                        Info = Guid.NewGuid().ToString()
                    };

                    Recovery.Include(operation);
                    var first = Recovery.ItemFile(operation).FullName;
                    Assert.Equal(first, Recovery.MasterFile(operation).Lines().First());

                    operation = new Operation(resourceManager)
                    {
                        Info = Guid.NewGuid().ToString()
                    };

                    Recovery.Include(operation);
                    var last = Recovery.ItemFile(operation).FullName;
                    Assert.Equal(first, Recovery.MasterFile(operation).Lines().First());
                    Assert.Equal(last, Recovery.MasterFile(operation).Lines().Last());
                }
            }
            finally
            {
                Recovery.MasterDirectory = null;
            }
        }
Ejemplo n.º 4
0
        public void op_ItemFile_Operation_stringNull()
        {
            var operation = new Operation(Guid.NewGuid())
            {
                Info = Guid.NewGuid().ToString()
            };

            var id = operation.Identity;

            var expected = Recovery.MasterDirectory.ToDirectory(id.ResourceManager).ToFile("{0}.xml".FormatWith(id.Instance)).FullName;
            var actual   = Recovery.ItemFile(operation, null).FullName;

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 5
0
 public void op_ItemFile_OperationNull_string()
 {
     Assert.Throws <ArgumentNullException>(() => Recovery.ItemFile(null, "Example"));
 }
Ejemplo n.º 6
0
 public void op_ItemFile_OperationNull()
 {
     Assert.Throws <ArgumentNullException>(() => Recovery.ItemFile(null));
 }