Ejemplo n.º 1
0
        public void GetHexDigitStringFromMapWorksCorrectly()
        {
            var map            = new byte[] { 0x_ab, 0x_cd, 0x_ef, 0x_01, 0x_23, 0x_45, 0x_67, 0x_89 };
            var expectedString = "ABCDEF0123456789";

            var result = StreakTypeService.GetHexDigitStringFromMap(map);

            Assert.That.AreEqual(expectedString, result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Write the map to the view state but not to the database
        /// </summary>
        private void SaveMapState()
        {
            var streakType   = GetStreakType();
            var map          = GetTargetMap();
            var errorMessage = string.Empty;

            foreach (ListItem checkbox in cblCheckboxes.Items)
            {
                var representedDate = checkbox.Value.AsDateTime();

                if (representedDate.HasValue)
                {
                    map = StreakTypeService.SetBit(map, streakType.StartDate, representedDate.Value,
                                                   streakType.OccurrenceFrequency, checkbox.Selected, out errorMessage);
                }
            }

            ViewState[ViewStateKey.Map] = StreakTypeService.GetHexDigitStringFromMap(map);
        }