コード例 #1
0
ファイル: Program.cs プロジェクト: rioka/RegistryComparer
        private void TakeSnapshot()
        {
            RegistrySnapshot        snapshot;
            RegistrySnapshotBuilder builder;

            builder  = new RegistrySnapshotBuilder();
            snapshot = new RegistrySnapshot();

            foreach (string key in _keys)
            {
                this.PerformAction(() =>
                {
                    RegistryKeySnapshot keySnapshot;

                    keySnapshot      = builder.TakeSnapshot(key);
                    keySnapshot.Name = key;

                    snapshot.Keys.Add(keySnapshot);
                }, $"Snapshotting {key}");
            }

            _currentSnapshot = snapshot;

            this.SaveSnapshot();

            if (this.ExitCode == ExitCode.InvalidArguments)
            {
                this.ExitCode = ExitCode.Success;
            }
        }
コード例 #2
0
        public void TakeSnapshot_should_return_snapshot_of_single_key()
        {
            // arrange
            RegistrySnapshotBuilder target;
            RegistryKeySnapshot     snapshot;
            RegistryKeySnapshot     compare;
            RegistrySnapshot        lhs;
            RegistrySnapshot        rhs;

            ChangeResult[] expected;
            ChangeResult[] actual;

            target       = new RegistrySnapshotBuilder();
            compare      = this.LoadBaseSnapshot().Keys[0];
            compare.Name = "Tests";
            lhs          = new RegistrySnapshot();
            lhs.Keys.Add(compare);

            expected = new ChangeResult[0];

            this.CreateBase();

            // act
            snapshot = target.TakeSnapshot(this.FullRootKeyName);

            // assert
            rhs = new RegistrySnapshot();
            rhs.Keys.Add(snapshot);
            actual = new RegistrySnapshotComparer(lhs, rhs).Compare();
            CollectionAssert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void TakeSnapshot_should_return_snapshot_of_single_key()
        {
            // arrange
              RegistrySnapshotBuilder target;
              RegistryKeySnapshot actual;
              RegistryKeySnapshot expected;

              target = new RegistrySnapshotBuilder();
              expected = this.LoadBaseSnapshot().
                      Keys[0];
              expected.Name = "Tests";

              this.CreateBase();

              // act
              actual = target.TakeSnapshot(this.FullRootKeyName);

              // assert
        }
コード例 #4
0
        public void TakeSnapshot_should_return_snapshot_of_single_key()
        {
            // arrange
            RegistrySnapshotBuilder target;
            RegistryKeySnapshot     actual;
            RegistryKeySnapshot     expected;

            target   = new RegistrySnapshotBuilder();
            expected = this.LoadBaseSnapshot().
                       Keys[0];
            expected.Name = "Tests";

            this.CreateBase();

            // act
            actual = target.TakeSnapshot(this.FullRootKeyName);

            // assert
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: cyotek/RegistryComparer
    private void TakeSnapshot()
    {
      RegistrySnapshot snapshot;
      RegistrySnapshotBuilder builder;

      builder = new RegistrySnapshotBuilder();
      snapshot = new RegistrySnapshot();

      foreach (string key in _keys)
      {
        this.PerformAction(() =>
                           {
                             RegistryKeySnapshot keySnapshot;

                             keySnapshot = builder.TakeSnapshot(key);
                             keySnapshot.Name = key;

                             snapshot.Keys.Add(keySnapshot);
                           }, $"Snapshotting {key}");
      }

      _currentSnapshot = snapshot;

      this.SaveSnapshot();

      if (this.ExitCode == ExitCode.InvalidArguments)
      {
        this.ExitCode = ExitCode.Success;
      }
    }