예제 #1
0
        public async Task UpdateAllAsync_UpdatersInvoked()
        {
            var userQuestionDatas = Collections.CreateList
                                    (
                CreateUserQuestionData(0),
                CreateUserQuestionData(1),
                CreateUserQuestionData(2)
                                    );

            var impl1 = new MockUserQuestionDataUpdater();
            var impl2 = new MockUserQuestionDataUpdater();

            var mockImplFactory = new Mock <IUserQuestionDataUpdaterImplFactory>();

            SetupMockImplFactory(mockImplFactory, userQuestionDatas[0], impl1);
            SetupMockImplFactory(mockImplFactory, userQuestionDatas[1], impl1);
            SetupMockImplFactory(mockImplFactory, userQuestionDatas[2], impl2);

            var aggregateUpdater = new AggregateUserQuestionDataUpdater
                                   (
                mockImplFactory.Object
                                   );

            foreach (var uqd in userQuestionDatas)
            {
                aggregateUpdater.AddToBatch(uqd);
            }

            await aggregateUpdater.UpdateAllAsync();

            Assert.True(impl1.VerifyUpdates(Collections.CreateList(0, 1)));
            Assert.True(impl2.VerifyUpdates(Collections.CreateList(2)));
        }
예제 #2
0
 /// <summary>
 /// Verify that update was called with the given question IDs.
 /// </summary>
 public bool VerifyUpdates(IEnumerable <int> questionIds)
 {
     return(_userQuestionDataUpdater.VerifyUpdates(questionIds));
 }