예제 #1
0
        private void assert(StorageList <TestChild> storageList, string expectedStored, string expectedAll)
        {
            sb.Clear();
            foreach (var item in storageList.GetStoredItems())
            {
                sb.AppendLine(item.ToString());
            }
            if (expectedStored.Length == 0)
            {
                Assert.AreEqual(0, sb.Length);
            }
            else
            {
                expectedStored = expectedStored.Replace(Environment.NewLine + "          ", Environment.NewLine);
                Assert.AreEqual(expectedStored + Environment.NewLine, sb.ToString());
            }

            sb.Clear();
            foreach (var item in storageList)
            {
                sb.AppendLine(item.ToString());
            }
            if (expectedAll.Length == 0)
            {
                Assert.AreEqual(0, sb.Length);
            }
            else
            {
                expectedAll = expectedAll.Replace(Environment.NewLine + "          ", Environment.NewLine);
                Assert.AreEqual(expectedAll + Environment.NewLine, sb.ToString());
            }

            //var parent = storageList.Parent;
            //sb.Clear();
            //foreach (var item in parent.Children) {
            //  sb.AppendLine(item.ToString());
            //}
            //if (expectedForEach.Length==0) {
            //  Assert.AreEqual(0, sb.Length);
            //} else {
            //  expectedForEach = expectedForEach.Replace(Environment.NewLine + "          ", Environment.NewLine);
            //  Assert.AreEqual(expectedForEach + Environment.NewLine, sb.ToString());
            //}
            //sb.Clear();
            //foreach (var item in parent.Children.GetAll()) {
            //  sb.AppendLine(item.ToString());
            //}
            //if (expectedGetAll.Length==0) {
            //  Assert.AreEqual(0, sb.Length);
            //} else {
            //  expectedGetAll = expectedGetAll.Replace(Environment.NewLine + "          ", Environment.NewLine);
            //  Assert.AreEqual(expectedGetAll + Environment.NewLine, sb.ToString());
            //}
        }