示例#1
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));
            }
        }
示例#2
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);
        }
示例#3
0
        public StackHashMapping FindMapping(StackHashMappingType mappingType, int id)
        {
            foreach (StackHashMapping mapping in this)
            {
                if ((mapping.MappingType == mappingType) && (mapping.Id == id))
                {
                    return(mapping);
                }
            }

            return(null);
        }
示例#4
0
 public StackHashMapping(StackHashMappingType mappingType, int id, String name)
 {
     m_MappingType = mappingType;
     m_Id          = id;
     m_Name        = name;
 }
示例#5
0
 /// <summary>
 /// Gets the mappings of a particular type.
 /// </summary>
 /// <returns>Collection of mappings.</returns>
 public StackHashMappingCollection GetMappings(StackHashMappingType mappingType)
 {
     return(null);
 }