예제 #1
0
        public void DefaultSecurityDataCombiner_Combine_Overlap1()
        {
            SecurityData data1 = new SecurityData("1", "TopCoder", new string[] { "1", "2", "3" });
            SecurityData data2 = new SecurityData("2", "IBM", new string[] { "4", "2", "3" });

            SecurityData result = test.Combine(data1, data2);

            // get the property to test the method.
            Assert.AreEqual("1", result.Id, "The Id property should be set to '1'.");
            Assert.AreEqual("TopCoder", result.CompanyName, "The CompanyName property should be set to 'TopCoder'.");

            ArrayList ids = new ArrayList(result.ReferenceIds);

            // we check the length of the array first.
            Assert.AreEqual(4, ids.Count, "The number of the ids should be equal.");
            Assert.IsTrue(ids.Contains("1"), "The result should contain this reference id");
            Assert.IsTrue(ids.Contains("2"), "The result should contain this reference id");
            Assert.IsTrue(ids.Contains("3"), "The result should contain this reference id");
            Assert.IsTrue(ids.Contains("4"), "The result should contain this reference id");
        }
        public void BenchmarkCombinePerformance()
        {
            SecurityData result;

            Start();
            for (int i = 0; i < ITERATION; i++)
            {
                result = combiner.Combine(first, second);
                Assert.IsNotNull(result, "the DefaultSecurityDataCombiner.Combine is wrong.");
                Assert.AreEqual(result.Id, first.Id, "the DefaultSecurityDataCombiner.Combine is wrong.");
                Assert.AreEqual(result.CompanyName, first.CompanyName,
                                "the DefaultSecurityDataCombiner.Combine is wrong.");
                Assert.AreEqual(4, result.ReferenceIds.Length, "the DefaultSecurityDataCombiner.Combine is wrong.");
            }
            Stop("Run DefaultSecurityDataCombiner.Combine() ");
        }