Exemplo n.º 1
0
        public void TestMethod1()
        {
            IProjectEnumerable project = new ProjectEnumerable();

            for (int i = 0; i < 3; i++)
            {
                project.Add("name" + i, 2, 3);
            }
            IEnumerator projectIterator = project.GetEnumerator();

            while (projectIterator.MoveNext())
            {
                IProjectEnumerable p = (IProjectEnumerable)projectIterator.Current;
                if (p != null)
                {
                    Debug.WriteLine($"人员信息: \n {p.GetProjectInfo()}");
                }
            }
            //Debug Trace:
            //人员信息:
            //项目名称是:name0 项目人数: 2  项目费用:3
            //人员信息:
            //项目名称是:name1 项目人数: 2  项目费用:3
            //人员信息:
            //项目名称是:name2 项目人数: 2  项目费用:3
        }
Exemplo n.º 2
0
        public void SouldReturn2ProjectsNotNulls()
        {
            var projectEnumerable = new ProjectEnumerable(new Project(), null, new Project());

            var currentNumberProjects = projectEnumerable.GetTotalOfProjects();

            var expectedNumberProjects = 2;

            Assert.Equal(expectedNumberProjects, currentNumberProjects);
        }