コード例 #1
0
        public void DefaultStubBehavior_TaskOfIntReturnType_ReturnsNullTask()
        {
            var stub = new StubIService() as IService;
            var task = stub.ReturnIntAsync();

            Assert.IsNull(task);
        }
コード例 #2
0
        public void AsyncStubBehavior_TaskOfIntReturnType_ReturnsCompletedTask()
        {
            var stub = new StubIService {
                InstanceBehavior = new AsyncAwareDefaultValueStubBehavior()
            } as IService;
            var task = stub.ReturnIntAsync();

            Assert.IsNotNull(task);
            Assert.IsTrue(task.IsCompleted && !task.IsFaulted && !task.IsCanceled);
            Assert.AreEqual(0, task.Result);
        }