Esempio n. 1
0
 /// <summary>
 /// FileType Constructor using BaseFileType and FileTypeModifier
 /// </summary>
 /// <param name="basetype">BaseFileType</param>
 /// <param name="modifiers">FileTypeModifier</param>
 public FileType(BaseFileType basetype, FileTypeModifier modifiers)
 {
     if ((modifiers & FileTypeModifier.NRevsOnly) != 0)
     {
         throw new ArgumentException("need to specify number of revs to store");
     }
     BaseType   = basetype;
     Modifiers  = modifiers;
     StoredRevs = 0;
 }
Esempio n. 2
0
        public void ModifiersTest()
        {
            FileTypeModifier modifiers  = FileTypeModifier.CompressedFiles | FileTypeModifier.HeadrevOnly;
            BaseFileType     basetype   = BaseFileType.Text;                             // TODO: Initialize to an appropriate value
            int              storedrevs = 0;                                             // TODO: Initialize to an appropriate value
            FileType         target     = new FileType(basetype, modifiers, storedrevs); // TODO: Initialize to an appropriate value
            FileTypeModifier expected   = modifiers;

            Assert.AreEqual(expected, target.Modifiers);
        }
Esempio n. 3
0
        public void StoredRevsTest()
        {
            BaseFileType     basetype  = BaseFileType.Text;                             // TODO: Initialize to an appropriate value
            FileTypeModifier modifiers = FileTypeModifier.NRevsOnly;                    // TODO: Initialize to an appropriate value
            int      storedrevs        = 16;
            FileType target            = new FileType(basetype, modifiers, storedrevs); // TODO: Initialize to an appropriate value
            int      expected          = storedrevs;
            int      actual;

            target.StoredRevs = expected;
            actual            = target.StoredRevs;
            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void BaseTypeTest()
        {
            BaseFileType     basetype  = BaseFileType.Text;                             // TODO: Initialize to an appropriate value
            FileTypeModifier modifiers = FileTypeModifier.None;                         // TODO: Initialize to an appropriate value
            int          storedrevs    = 0;                                             // TODO: Initialize to an appropriate value
            FileType     target        = new FileType(basetype, modifiers, storedrevs); // TODO: Initialize to an appropriate value
            BaseFileType expected      = BaseFileType.Symlink;
            BaseFileType actual;

            target.BaseType = expected;
            actual          = target.BaseType;
            Assert.AreEqual(expected, actual);
        }
Esempio n. 5
0
        /// <summary>
        /// FileType Constructor
        /// </summary>
        /// <param name="basetype">Base FileType</param>
        /// <param name="modifiers">FileTypeModifier</param>
        /// <param name="storedrevs">number of stored revs (default 0)</param>
        public FileType(BaseFileType basetype, FileTypeModifier modifiers, int storedrevs)
        {
            if (((modifiers & FileTypeModifier.NRevsOnly) != 0) &&
                (storedrevs < 1 | storedrevs > 10) &&
                (storedrevs != 16) &&
                (storedrevs != 32) &&
                (storedrevs != 64) &&
                (storedrevs != 128) &&
                (storedrevs != 256) &&
                (storedrevs != 512))
            {
                throw new ArgumentException("invalid number of revs to store");
            }

            BaseType   = basetype;
            Modifiers  = modifiers;
            StoredRevs = storedrevs;
        }