public async Task Then_If_There_Is_No_Code_Null_Is_Returned( [Frozen] Mock <IProviderCommitmentsDbContext> dbContext, TrainingProgrammeLookup service) { //Act var actual = await service.GetTrainingProgramme(""); //Assert actual.Should().BeNull(); }
public async Task Then_Returns_List_Of_Standards( List <Standard> standards, [Frozen] Mock <IProviderCommitmentsDbContext> dbContext, TrainingProgrammeLookup service) { //Arrange dbContext.Setup(x => x.Standards).ReturnsDbSet(standards); //Act var actual = (await service.GetAllStandards()).ToList(); //Assert actual.Count.Should().Be(standards.Count); }
public async Task Then_If_It_Is_Not_Numeric_Then_Frameworks_Are_Searched( Framework framework, List <Framework> frameworks, [Frozen] Mock <IProviderCommitmentsDbContext> dbContext, TrainingProgrammeLookup service ) { //Arrange frameworks.Add(framework); dbContext.Setup(x => x.Frameworks).ReturnsDbSet(frameworks); //Act var actual = await service.GetTrainingProgramme(framework.Id); //Assert actual.CourseCode.Should().Be(framework.Id); actual.Name.Should().Be($"{framework.Title}, Level: {framework.Level}"); actual.EffectiveFrom.Should().Be(framework.EffectiveFrom); actual.EffectiveTo.Should().Be(framework.EffectiveTo); actual.ProgrammeType.Should().Be(ProgrammeType.Framework); dbContext.Verify(x => x.Standards.FindAsync(It.IsAny <int>()), Times.Never); }
public async Task Then_If_The_Course_Code_Is_Numeric_Then_Standards_Are_Searched( Standard standard, List <Standard> standards, [Frozen] Mock <IProviderCommitmentsDbContext> dbContext, TrainingProgrammeLookup service ) { //Arrange standards.Add(standard); dbContext.Setup(x => x.Standards).ReturnsDbSet(standards); //Act var actual = await service.GetTrainingProgramme(standard.Id.ToString()); //Assert actual.CourseCode.Should().Be(standard.Id.ToString()); actual.Name.Should().Be($"{standard.Title}, Level: {standard.Level} (Standard)"); actual.EffectiveFrom.Should().Be(standard.EffectiveFrom); actual.EffectiveTo.Should().Be(standard.EffectiveTo); actual.ProgrammeType.Should().Be(ProgrammeType.Standard); dbContext.Verify(x => x.Frameworks.FindAsync(It.IsAny <int>()), Times.Never); }