示例#1
0
        public void Add1Mapping()
        {
            StackHashMappingCollection mappings = new StackHashMappingCollection();

            mappings.Add(new StackHashMapping(StackHashMappingType.Group, 1, "Active"));
            addMappings(StackHashMappingType.Group, mappings, 1);
        }
示例#2
0
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        /// <summary>
        /// Adds the specified number of Mappings to the MappingsTable.
        /// </summary>
        public void addMappings(StackHashMappingType mappingType, StackHashMappingCollection mappings, int expectedCount)
        {
            // Create a clean index.
            m_Index = new SqlErrorIndex(StackHashSqlConfiguration.Default, SqlUtils.UnitTestDatabase, m_RootCabFolder);
            m_Index.DeleteIndex();
            m_Index.Activate();

            StackHashMappingCollection currentMappings = m_Index.GetMappings(mappingType);

            if (mappingType == StackHashMappingType.WorkFlow)
            {
                Assert.AreEqual(16, currentMappings.Count);
            }
            else
            {
                Assert.AreEqual(0, currentMappings.Count);
            }

            m_Index.AddMappings(mappings);

            currentMappings = m_Index.GetMappings(mappingType);
            Assert.AreEqual(expectedCount, currentMappings.Count);


            foreach (StackHashMapping mapping in mappings)
            {
                StackHashMapping matchingMapping = mappings.FindMapping(mapping.MappingType, mapping.Id);
                Assert.AreNotEqual(null, matchingMapping);

                Assert.AreEqual(0, mapping.CompareTo(matchingMapping));
            }
        }
示例#3
0
        public void Add2MappingsDifferentTypesSameIdCheckGroup()
        {
            StackHashMappingCollection mappings = new StackHashMappingCollection();

            mappings.Add(new StackHashMapping(StackHashMappingType.WorkFlow, 1, "Active"));
            mappings.Add(new StackHashMapping(StackHashMappingType.Group, 1, "Active"));
            addMappings(StackHashMappingType.Group, mappings, 1);
        }
示例#4
0
        public void Add2MappingsDuplicatesNonZeroType()
        {
            StackHashMappingCollection mappings = new StackHashMappingCollection();

            mappings.Add(new StackHashMapping(StackHashMappingType.Group, 1, "Active"));
            mappings.Add(new StackHashMapping(StackHashMappingType.Group, 1, "Active"));
            addMappings(StackHashMappingType.Group, mappings, 1);
        }
示例#5
0
        private StackHashMapping findMapping(StackHashMappingCollection mappings, StackHashMappingType mappingType, int id)
        {
            foreach (StackHashMapping mapping in mappings)
            {
                if ((mapping.MappingType == mappingType) && (mapping.Id == id))
                {
                    return(mapping);
                }
            }

            return(null);
        }
示例#6
0
        public void AddNoMappings()
        {
            StackHashMappingCollection mappings = new StackHashMappingCollection();

            addMappings(StackHashMappingType.Group, mappings, 0);
        }
示例#7
0
        public void DefaultWorkFlow()
        {
            StackHashMappingCollection mappings = null;

            addMappings(StackHashMappingType.WorkFlow, mappings, 16);
        }
示例#8
0
        public void NullMappingsException()
        {
            StackHashMappingCollection mappings = null;

            addMappings(StackHashMappingType.Group, mappings, 0);
        }
示例#9
0
 /// <summary>
 /// Adds the specified mappings. If they exist already they will be overwritten.
 /// </summary>
 /// <returns>Collection of mappings.</returns>
 public void AddMappings(StackHashMappingCollection mappings)
 {
 }