Exemple #1
0
        public async Task Then_Inserts_Records_Into_DbContext(
            List <ProviderRegistrationFeedbackRating> items,
            [Frozen] Mock <ICourseDeliveryDataContext> mockContext,
            Data.Repository.ProviderRegistrationFeedbackRatingRepository repository)
        {
            await repository.InsertMany(items);

            mockContext.Verify(context => context.ProviderRegistrationFeedbackRatings.AddRangeAsync(
                                   items,
                                   It.IsAny <CancellationToken>()), Times.Once);
            mockContext.Verify(context => context.SaveChanges(), Times.Once);
        }
        public void Then_Deletes_All_Records_In_Db(
            List <ProviderRegistrationFeedbackRating> itemsInDb,
            [Frozen] Mock <ICourseDeliveryDataContext> mockContext,
            Data.Repository.ProviderRegistrationFeedbackRatingRepository repository)
        {
            mockContext
            .Setup(context => context.ProviderRegistrationFeedbackRatings)
            .ReturnsDbSet(itemsInDb);

            repository.DeleteAll();

            mockContext.Verify(context => context.ProviderRegistrationFeedbackRatings.RemoveRange(itemsInDb), Times.Once);
            mockContext.Verify(context => context.SaveChanges(), Times.Once);
        }