本文整理汇总了C#中ProjectManager.Unassign方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.Unassign方法的具体用法?C# ProjectManager.Unassign怎么用?C# ProjectManager.Unassign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.Unassign方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnassignResourceFromAllTask
public void UnassignResourceFromAllTask()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
var r1 = new object();
var r2 = new object();
manager.Add(one);
manager.Add(two);
// setup: assign some resource
manager.Assign(one, r1);
manager.Assign(one, r2);
manager.Assign(two, r1);
manager.Assign(two, r2);
Assert.IsTrue(manager.Resources.Count() == 2);
Assert.IsTrue(manager.ResourcesOf(one).Contains(r1));
Assert.IsTrue(manager.ResourcesOf(one).Contains(r2));
Assert.IsTrue(manager.ResourcesOf(two).Contains(r1));
Assert.IsTrue(manager.ResourcesOf(two).Contains(r2));
Assert.IsTrue(manager.TasksOf(r1).Contains(one));
Assert.IsTrue(manager.TasksOf(r2).Contains(one));
Assert.IsTrue(manager.TasksOf(r1).Contains(two));
Assert.IsTrue(manager.TasksOf(r2).Contains(two));
manager.Unassign(r1);
Assert.IsTrue(manager.Resources.Count() == 1, string.Format("Expected {0} != {1}", 1, manager.Resources.Count()));
Assert.IsTrue(!manager.ResourcesOf(one).Contains(r1));
Assert.IsTrue(manager.ResourcesOf(one).Contains(r2));
Assert.IsTrue(!manager.ResourcesOf(two).Contains(r1));
Assert.IsTrue(manager.ResourcesOf(two).Contains(r2));
Assert.IsTrue(!manager.TasksOf(r1).Contains(one));
Assert.IsTrue(manager.TasksOf(r2).Contains(one));
Assert.IsTrue(!manager.TasksOf(r1).Contains(two));
Assert.IsTrue(manager.TasksOf(r2).Contains(two));
}
示例2: UnassignSpecificResource
public void UnassignSpecificResource()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var r1 = new Task();
var r2 = new Task();
manager.Add(one);
// setup: assign some resource
manager.Assign(one, r1);
manager.Assign(one, r2);
Assert.IsTrue(manager.Resources.Count() == 2);
Assert.IsTrue(manager.ResourcesOf(one).Contains(r1));
Assert.IsTrue(manager.ResourcesOf(one).Contains(r2));
Assert.IsTrue(manager.TasksOf(r1).Contains(one));
Assert.IsTrue(manager.TasksOf(r2).Contains(one));
// test: unassign resource
manager.Unassign(one, r2);
Assert.IsTrue(manager.Resources.Count() == 1);
Assert.IsTrue(manager.ResourcesOf(one).Contains(r1));
Assert.IsTrue(!manager.ResourcesOf(one).Contains(r2));
Assert.IsTrue(manager.TasksOf(r1).Contains(one));
Assert.IsTrue(!manager.TasksOf(r2).Contains(one));
}
示例3: UnassignAllResourceFromTask
public void UnassignAllResourceFromTask()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
var r1 = new Task();
var r2 = new Task();
manager.Add(one);
manager.Add(two);
// setup: assign some resource
manager.Assign(one, r1);
manager.Assign(one, r2);
manager.Assign(two, r1);
manager.Assign(two, r2);
Assert.IsTrue(manager.Resources.Count() == 2);
Assert.IsTrue(manager.ResourcesOf(one).Contains(r1));
Assert.IsTrue(manager.ResourcesOf(one).Contains(r2));
Assert.IsTrue(manager.ResourcesOf(two).Contains(r1));
Assert.IsTrue(manager.ResourcesOf(two).Contains(r2));
Assert.IsTrue(manager.TasksOf(r1).Contains(one));
Assert.IsTrue(manager.TasksOf(r2).Contains(one));
Assert.IsTrue(manager.TasksOf(r1).Contains(two));
Assert.IsTrue(manager.TasksOf(r2).Contains(two));
manager.Unassign(one);
Assert.IsTrue(manager.Resources.Count() == 2);
Assert.IsTrue(!manager.ResourcesOf(one).Contains(r1));
Assert.IsTrue(!manager.ResourcesOf(one).Contains(r2));
Assert.IsTrue(manager.ResourcesOf(two).Contains(r1));
Assert.IsTrue(manager.ResourcesOf(two).Contains(r2));
Assert.IsTrue(!manager.TasksOf(r1).Contains(one));
Assert.IsTrue(!manager.TasksOf(r2).Contains(one));
Assert.IsTrue(manager.TasksOf(r1).Contains(two));
Assert.IsTrue(manager.TasksOf(r2).Contains(two));
}