示例#1
0
        public void ListSourceConstructor()
        {
            tlog.Debug(tag, $"ListSourceConstructor START");

            var testingTarget = new ListSource();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceConstructor END (OK)");
        }
示例#2
0
        public void ListSourceConstructorWithEnumerableObject()
        {
            tlog.Debug(tag, $"ListSourceConstructorWithEnumerableObject START");

            IEnumerable <string> para = new List <string>();
            var testingTarget         = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceConstructorWithEnumerableObject END (OK)");
        }
示例#3
0
        public void ListSourceGetItem()
        {
            tlog.Debug(tag, $"ListSourceGetItem START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");
            Assert.AreEqual(testingTarget.GetItem(0), 1, "The value of the first item of ListSouce should be 1.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceGetItem END (OK)");
        }
示例#4
0
        public void ListSourceSyncRoot()
        {
            tlog.Debug(tag, $"ListSourceSyncRoot START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");
            Assert.IsNotNull(testingTarget.SyncRoot, "SyncRoot of ListSouce should not be null.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceSyncRoot END (OK)");
        }
示例#5
0
        public void ListSourceCount()
        {
            tlog.Debug(tag, $"ListSourceCount START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");
            Assert.AreEqual(testingTarget.Count, 3, "Count of ListSouce should be equal to 3.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceCount END (OK)");
        }
示例#6
0
        public void ListSourceIsSynchronized()
        {
            tlog.Debug(tag, $"ListSourceIsSynchronized START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            tlog.Debug(tag, "IsSynchronized : " + testingTarget.IsSynchronized);

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceIsSynchronized END (OK)");
        }
示例#7
0
        public void ListSourceClear()
        {
            tlog.Debug(tag, $"ListSourceClear START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            testingTarget.Clear();
            Assert.AreEqual(testingTarget.Count, 0, "The ListSouce should be empty after cleared.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceClear END (OK)");
        }
示例#8
0
        public void ListSourceIsHeader()
        {
            tlog.Debug(tag, $"ListSourceIsHeader START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            testingTarget.HasHeader = true;
            Assert.IsTrue(testingTarget.IsHeader(0), "The first item of ListSouce should be header.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceIsHeader END (OK)");
        }
示例#9
0
        public void ListSourceIsFooter()
        {
            tlog.Debug(tag, $"ListSourceIsFooter START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            testingTarget.HasFooter = true;
            tlog.Debug(tag, "IsFooter : " + testingTarget.IsFooter(2));

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceIsFooter END (OK)");
        }
示例#10
0
        public void ListSourceIndexOf()
        {
            tlog.Debug(tag, $"ListSourceIndexOf START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            var ret = testingTarget.IndexOf(1);

            Assert.AreEqual(ret, 0, "The index of ListSouce should be 0.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceIndexOf END (OK)");
        }
示例#11
0
        public void ListSourceContains()
        {
            tlog.Debug(tag, $"ListSourceContains START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            var ret = testingTarget.Contains(3);

            Assert.IsTrue(ret, "The ListSouce should contain 3.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceContains END (OK)");
        }
示例#12
0
        public void ListSourceAdd()
        {
            tlog.Debug(tag, $"ListSourceAdd START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            var ret = testingTarget.Add(4);

            Assert.AreEqual(ret, 3, "The index of ListSouce should is 3.");
            Assert.AreEqual(testingTarget.Count, 4, "The count of ListSouce should be 4.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceAdd END (OK)");
        }
示例#13
0
        public void ListSourceCopyTo()
        {
            tlog.Debug(tag, $"ListSourceCopyTo START");

            var para          = new TestEnumerable();
            var testingTarget = new ListSource(para);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ListSource>(testingTarget, "should be an instance of testing target class!");

            Array intArray = Array.CreateInstance(typeof(int), 10);

            intArray.SetValue(4, 0);
            testingTarget.CopyTo(intArray, 2);
            tlog.Debug(tag, "Count : " + testingTarget.Count);

            testingTarget.Dispose();
            tlog.Debug(tag, $"ListSourceCopyTo END (OK)");
        }