Ejemplo n.º 1
0
        public void Cancelled_Type_Task_T_Should_Be_Cancelled()
        {
            var target = TaskBuilder.GetCancelled(typeof(Task <int>));

            target.IsCanceled.Should().BeTrue();
            target.Should().BeOfType <Task <int> >();
        }
Ejemplo n.º 2
0
        public void Cancelled_Type_Task_Should_Be_Cancelled()
        {
            var target = TaskBuilder.GetCancelled(typeof(Task));

            target.IsCanceled.Should().BeTrue();
            target.Should().BeAssignableTo <Task>();
        }
Ejemplo n.º 3
0
        public void Intercept(IInvocation invocation)
        {
            if (TypeHelper.IsActorCompleteLifeCycleTypeOrBase(invocation.Method.DeclaringType))
            {
                Cancel(invocation);
                return;
            }

            var actor = GetCorrectActor();

            if (actor != null)
            {
                invocation.ReturnValue = invocation.CallOn(actor);
            }
            else
            {
                invocation.ReturnValue = TaskBuilder.GetCancelled(invocation.Method.ReturnType);
            }
        }
Ejemplo n.º 4
0
        public void Cancelled_Type_Object_Should_Be_Null()
        {
            var target = TaskBuilder.GetCancelled(typeof(object));

            target.Should().BeNull();
        }