private Project(Asset asset) : base(asset, null)
        {
            // the following check is for unit tests
            if (asset == null || asset.Children == null)
            {
                return;
            }

            Children.AddRange(asset.Children.Select(item => WorkitemFactory.CreateProject(item, this)));
        }
Beispiel #2
0
        internal Workitem(Asset asset, Workitem parent, IEntityContainer entityContainer) : base(asset, entityContainer)
        {
            Parent = parent;

            //TODO maybe make one more constructor for tests instead of this?
            // the following check is for unit tests
            if (asset == null || asset.Children == null)
            {
                return;
            }

            if (!SupportedTypes.Contains(asset.AssetType.Token))
            {
                throw new ArgumentException(string.Format("Illegal asset type, '{0}' is not supported.", asset.AssetType.Token));
            }

            foreach (var childAsset in asset.Children.Where(childAsset => DataLayer.ShowAllTasks || DataLayer.AssetPassesShowMyTasksFilter(childAsset)))
            {
                Children.Add(WorkitemFactory.CreateWorkitem(childAsset, this, entityContainer));
                Children.Sort(new WorkitemComparer(TestType, TaskType));
            }

            Children.TrimExcess();
        }