public async Task Then_Inserts_Records_Into_DbContext( List <ProviderRegistrationFeedbackAttributeImport> importsInDb, [Frozen] Mock <ICourseDeliveryDataContext> mockContext, Data.Repository.Import.ProviderRegistrationFeedbackAttributeImportRepository repository) { await repository.InsertMany(importsInDb); mockContext.Verify(context => context.ProviderRegistrationFeedbackAttributeImports.AddRangeAsync( importsInDb, It.IsAny <CancellationToken>()), Times.Once); mockContext.Verify(context => context.SaveChanges(), Times.Once); }
public async Task Then_Returns_All_Records_From_DbContext( List <ProviderRegistrationFeedbackAttributeImport> importsInDb, [Frozen] Mock <ICourseDeliveryDataContext> mockContext, Data.Repository.Import.ProviderRegistrationFeedbackAttributeImportRepository repository) { mockContext .Setup(context => context.ProviderRegistrationFeedbackAttributeImports) .ReturnsDbSet(importsInDb); var actual = await repository.GetAll(); actual.Should().BeEquivalentTo(importsInDb); }
public void Then_Deletes_All_Records_In_Db( List <ProviderRegistrationFeedbackAttributeImport> importsInDb, [Frozen] Mock <ICourseDeliveryDataContext> mockContext, Data.Repository.Import.ProviderRegistrationFeedbackAttributeImportRepository repository) { mockContext .Setup(context => context.ProviderRegistrationFeedbackAttributeImports) .ReturnsDbSet(importsInDb); repository.DeleteAll(); mockContext.Verify(context => context.ProviderRegistrationFeedbackAttributeImports.RemoveRange(importsInDb), Times.Once); mockContext.Verify(context => context.SaveChanges(), Times.Once); }