示例#1
0
 public void Test_CheckSetValue_True()
 // all flags were true and after SetFlag metod stay true.
 {
     IIG.BinaryFlag.MultipleBinaryFlag multiple_flag_obj = new IIG.BinaryFlag.MultipleBinaryFlag(2, true);
     multiple_flag_obj.SetFlag(0);
     multiple_flag_obj.SetFlag(1);
     Assert.True(multiple_flag_obj.GetFlag());
 }
示例#2
0
 public void Test_CheckGetFlagMethod_False_Case2()
 // set all flag except zero index value true
 {
     IIG.BinaryFlag.MultipleBinaryFlag multiple_flag_obj = new IIG.BinaryFlag.MultipleBinaryFlag(3, false);
     multiple_flag_obj.SetFlag(0);
     multiple_flag_obj.SetFlag(1);
     Assert.False(multiple_flag_obj.GetFlag());
 }
示例#3
0
        public void GetFlag_01_falseReturned()
        {
            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(2, false);

            mbf.SetFlag(1);

            Assert.AreEqual(false, mbf.GetFlag());
        }
示例#4
0
        public void GetFlag_0positionTrue_falseReturned()
        {
            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(1000, false);

            mbf.SetFlag(0);

            Assert.AreEqual(false, mbf.GetFlag());
        }
示例#5
0
        public void SetFlag_1_999_trueReturned()
        {
            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(999, false);
            for (ulong i = 0; i < 999; i++)
            {
                mbf.SetFlag(i);
            }

            Assert.AreEqual(true, mbf.GetFlag());
        }
示例#6
0
        public void SetFlagExceeedsLength()
        {
            bool expected = true;

            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(100, false);
            mbf.SetFlag(999999);
            bool actual = mbf.GetFlag();

            Assert.Equal(expected, actual);
        }
示例#7
0
 public void Test_CheckSetValue_Error_Case1()
 {
     IIG.BinaryFlag.MultipleBinaryFlag multiple_flag_obj = new IIG.BinaryFlag.MultipleBinaryFlag(2, false);
     try {
         multiple_flag_obj.SetFlag(2);
     } catch {
         Console.WriteLine("Specified argument was out of the range of valid values");
         // Assert.Pass();
         Assert.True(true);
     }
 }
示例#8
0
        public void GetFlag_0positionFalse_falseReturned()
        {
            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(1000, false);

            for (ulong i = 1; i < 1000; i++)
            {
                mbf.SetFlag(i);
            }

            Assert.AreEqual(false, mbf.GetFlag());
        }
示例#9
0
        public void CheckOnlyOneSetFlagOnWholeLength()
        {
            bool expected = false;

            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(1000, false);
            mbf.SetFlag(0);

            bool actual = mbf.GetFlag();

            Assert.Equal(expected, actual);
        }
示例#10
0
        public void GetFlagWithOnlyOneSetFlagReturnFalse()
        {
            bool expected = false;

            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(1000, false);
            mbf.SetFlag(300);

            bool actual = mbf.GetFlag();

            Assert.Equal(expected, actual);
        }
示例#11
0
        public void TestSetFlagReturnFalse()
        {
            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(20, false);
            for (ulong i = 0; i < 10; i++)
            {
                mbf.SetFlag(i);
            }
            bool actual = mbf.GetFlag();

            Assert.False(actual);
        }
示例#12
0
        public void GetFlagReturnsFalse()
        {
            bool expected = false;

            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(2, false);
            mbf.SetFlag(1);

            bool actual = mbf.GetFlag();

            Assert.Equal(expected, actual);
        }
示例#13
0
        public void CheckForEqualityAlmostSameBigger()
        {
            bool expected = false;

            IIG.BinaryFlag.MultipleBinaryFlag mbf1 = new IIG.BinaryFlag.MultipleBinaryFlag(50000, false);
            IIG.BinaryFlag.MultipleBinaryFlag mbf2 = new IIG.BinaryFlag.MultipleBinaryFlag(50000, false);
            mbf1.SetFlag(1489);

            bool actual = mbf1.Equals(mbf2);

            Assert.Equal(expected, actual);
        }
示例#14
0
        public void FileWorker_Add_Get_FlagFalseChanged()
        {
            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(10, false);
            mbf.SetFlag(2);

            IIG.FileWorker.BaseFileWorker.Write(mbf.GetFlag().ToString(), @"C:\Users\user\Desktop\Навчання\4 курс\7 семестр\КПІ-3\l4\l4\UnitTestL4\TextFile.txt");

            string expected = mbf.GetFlag().ToString();
            string actual   = IIG.FileWorker.BaseFileWorker.ReadAll(@"C:\Users\user\Desktop\Навчання\4 курс\7 семестр\КПІ-3\l4\l4\UnitTestL4\TextFile.txt");

            Assert.AreEqual(expected, actual);
        }
示例#15
0
 public void TestSetFlagExceedsLength()
 {
     try
     {
         IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(20, false);
         mbf.SetFlag(21);
     }
     catch (Exception e)
     {
         bool actual = e.Message.Contains("Position must be lesser than length");
         Assert.True(actual);
     }
 }
示例#16
0
        public void SetFlagReturnsTrue()
        {
            bool expected = true;

            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(100, false);
            for (ulong i = 0; i < 100; i++)
            {
                mbf.SetFlag(i);
            }
            bool actual = mbf.GetFlag();

            Assert.Equal(expected, actual);
        }
示例#17
0
        public void GetFlagRerunsFalseFromStart()
        {
            bool expected = false;

            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(1000, false);
            for (ulong i = 1; i < 1000; i++)
            {
                mbf.SetFlag(i);
            }

            bool actual = mbf.GetFlag();

            Assert.Equal(expected, actual);
        }
示例#18
0
        public void SetFlagExceedsLength()
        {
            bool expected = false;

            IIG.BinaryFlag.MultipleBinaryFlag mbf = new IIG.BinaryFlag.MultipleBinaryFlag(99, false);
            for (ulong i = 10; i < 999; i++)
            {
                mbf.SetFlag(i);
            }

            bool actual = mbf.GetFlag();

            Assert.Equal(expected, actual);
        }
示例#19
0
 public void Test_CheckSetValue_False_Case2()
 {
     IIG.BinaryFlag.MultipleBinaryFlag multiple_flag_obj = new IIG.BinaryFlag.MultipleBinaryFlag(2, false);
     multiple_flag_obj.SetFlag(0);
     Assert.False(multiple_flag_obj.GetFlag());
 }