public void should_return_a_list_of_all_sub_tasks_that_were_injected() { // Arrange var mockParentTask = new MockParentSimpleTask(); var task = new InjectSimpleTasks { In = { SimpleTaskContainingSubSimpleTasks = mockParentTask } }; // Act task.Execute(); // Assert Assert.That(task.Out.InjectedSubTaskPropertyNames[0], Is.EqualTo(typeof(MockSubSimpleTask<DateTime>).FullName)); }
public void should_set_sub_task_property_to_null_that_is_included_in_list_of_injected_property_names() { // Arrange var mockParentTask = new MockParentSimpleTask { MockSubSimpleClass = new MockSubSimpleTask<DateTime>() }; var task = new DisposeSimpleTasks { In = { Owner = mockParentTask, InjectedTaskNames = new[] { typeof(MockSubSimpleTask<DateTime>).FullName } } }; // Act task.Execute(); // Assert Assert.That(mockParentTask.MockSubSimpleClass, Is.Null); }
public void should_inject_sub_task_if_null() { // Arrange var mockParentTask = new MockParentSimpleTask(); var task = new InjectSimpleTasks { In = { SimpleTaskContainingSubSimpleTasks = mockParentTask } }; // Act task.Execute(); // Assert Assert.That(mockParentTask.MockSubSimpleClass, Is.Not.Null); }
public void should_not_inject_sub_task_if_not_null() { // Arrange var mockDifferentSubTask = new MockSubSimpleTask<DateTime>(); var mockParentTask = new MockParentSimpleTask { MockSubSimpleClass = mockDifferentSubTask }; var task = new InjectSimpleTasks { In = { SimpleTaskContainingSubSimpleTasks = mockParentTask } }; // Act task.Execute(); // Assert Assert.That(task.Out.InjectedSubTaskPropertyNames.Length, Is.EqualTo(0)); }
public void should_not_dispose_sub_task_property_that_is_not_included_in_list_of_injected_property_names() { // Arrange var mockSubTask = new MockSubSimpleTask<DateTime>(); var mockParentTask = new MockParentSimpleTask { MockSubSimpleClass = mockSubTask }; var task = new DisposeSimpleTasks { In = { Owner = mockParentTask, InjectedTaskNames = new[] { "bogus" } } }; // Act task.Execute(); // Assert Assert.That(mockSubTask.DisposeWasCalled, Is.False); }