public void should_set_sub_task_property_to_null_that_is_included_in_list_of_injected_property_names()
        {
            var mockParentTask = new MockParentTask { MockSubTask = new MockSubTask<DateTime>() };
            var task = new DisposeTasks { In = { Owner = mockParentTask, InjectedTaskNames = new[] { typeof(MockSubTask<DateTime>).FullName } } };
            task.Execute();

            Assert.That(mockParentTask.MockSubTask, Is.Null);
        }
        public void should_not_dispose_sub_task_property_that_is_not_included_in_list_of_injected_property_names()
        {
            var mockSubTask = new MockSubTask<DateTime>();
            var mockParentTask = new MockParentTask { MockSubTask = mockSubTask };
            var task = new DisposeTasks { In = { Owner = mockParentTask, InjectedTaskNames = new[] { "bogus" } } };
            task.Execute();

            Assert.That(mockSubTask.DisposeWasCalled, Is.False);
        }
Example #3
0
        public void should_not_set_sub_task_property_to_null_that_is_not_included_in_list_of_injected_property_names()
        {
            // Arrange
            var mockParentTask = new MockParentTask { MockSubTask = new MockSubTask<DateTime>() };
            var task = new DisposeTasks { In = { Owner = mockParentTask, InjectedTaskNames = new[] { "bogus" } } };

            // Act
            task.Execute();

            // Assert
            Assert.That(mockParentTask.MockSubTask, Is.Not.Null);
        }
Example #4
0
        public void should_dispose_sub_task_property_that_is_included_in_list_of_injected_property_names()
        {
            // Arrange
            var mockSubTask = new MockSubTask<DateTime>();
            var mockParentTask = new MockParentTask { MockSubTask = mockSubTask };
            var task = new DisposeTasks { In = { Owner = mockParentTask, InjectedTaskNames = new[] { typeof(MockSubTask<DateTime>).FullName } } };

            // Act
            task.Execute();

            // Assert
            Assert.That(mockSubTask.DisposeWasCalled, Is.True);
        }
 public override void AfterExecute(Task task)
 {
     var dispose = new DisposeTasks { In = { Owner = task, InjectedTaskNames = _injectedSubTaskPropertyNames.ToArray() } };
     dispose.Execute();
 }