public void SetUp() { EntityFrameworkMocks.SetupValidationPortalDbContext(ValidationPortalDbContextMock); TestSchoolYears = new List <SchoolYear>(new[] { new SchoolYear("2017", "2018", false) { Id = 0 }, new SchoolYear("2018", "2019", true) { Id = 1 }, new SchoolYear("2019", "2020", true) { Id = 2 }, }); EntityFrameworkMocks.SetupMockDbSet( EntityFrameworkMocks.GetQueryableMockDbSet(TestSchoolYears), ValidationPortalDbContextMock, x => x.SchoolYears, x => x.SchoolYears = It.IsAny <DbSet <SchoolYear> >(), TestSchoolYears); ValidationPortalDbContextMock.As <IDisposable>().Setup(x => x.Dispose()); DbContextFactoryMock.Setup(x => x.Create()).Returns(ValidationPortalDbContextMock.Object); }
public void SetUp() { DefaultTestAppUserSession = new AppUserSession { FocusedEdOrgId = 1234, FocusedSchoolYearId = 1, Id = "234", ExpiresUtc = DateTime.Now.AddMonths(1), UserIdentity = new ValidationPortalIdentity { AuthorizedEdOrgs = new List <EdOrg>() }, }; EntityFrameworkMocks.SetupValidationPortalDbContext(ValidationPortalDbContextMock); }
public void SetUp() { DefaultTestAppUserSession = new AppUserSession { Id = "testSessionId", ExpiresUtc = DateTime.UtcNow.AddHours(1), FocusedEdOrgId = 234, FocusedSchoolYearId = 345, UserIdentity = new ValidationPortalIdentity { AuthorizedEdOrgs = new List <EdOrg>(new[] { new EdOrg { Id = 10625 } }) } }; EntityFrameworkMocks.SetupValidationPortalDbContext(ValidationPortalDbContextMock); }
public void SetUp() { LoggingServiceMock.Setup(x => x.LogDebugMessage(It.IsAny <string>())); LoggingServiceMock.Setup(x => x.LogErrorMessage(It.IsAny <string>())); LoggingServiceMock.Setup(x => x.LogWarningMessage(It.IsAny <string>())); LoggingServiceMock.Setup(x => x.LogInfoMessage(It.IsAny <string>())); EntityFrameworkMocks.SetupValidationPortalDbContext(ValidationPortalDbContextMock); DefaultTestAppUserSession = new AppUserSession { FocusedEdOrgId = 1234, FocusedSchoolYearId = 1, Id = "234", ExpiresUtc = DateTime.Now.AddMonths(1), UserIdentity = new ValidationPortalIdentity { AuthorizedEdOrgs = new List <EdOrg>() }, }; var appUserSessions = new List <AppUserSession>(new[] { DefaultTestAppUserSession }); EntityFrameworkMocks.SetupMockDbSet( EntityFrameworkMocks.GetQueryableMockDbSet(appUserSessions), ValidationPortalDbContextMock, x => x.AppUserSessions, x => x.AppUserSessions = It.IsAny <DbSet <AppUserSession> >(), appUserSessions); DbContextFactoryMock .Setup(x => x.Create()) .Returns(ValidationPortalDbContextMock.Object); OdsConfigurationValuesMock .Setup(x => x.GetRawOdsConnectionString(It.IsAny <string>())) .Returns <string>(x => $"Test Connection string: EdFi_Ods_{x};"); var ruleValidations = new List <RuleValidation>(); EntityFrameworkMocks.SetupMockDbSet( EntityFrameworkMocks.GetQueryableMockDbSet(ruleValidations), SchoolYearDbContextMock, x => x.RuleValidations, x => x.RuleValidations = It.IsAny <DbSet <RuleValidation> >(), ruleValidations); var ruleValidationDetails = new List <RuleValidationDetail>(); EntityFrameworkMocks.SetupMockDbSet( EntityFrameworkMocks.GetQueryableMockDbSet(ruleValidationDetails), SchoolYearDbContextMock, x => x.RuleValidationDetails, x => x.RuleValidationDetails = It.IsAny <DbSet <RuleValidationDetail> >(), ruleValidationDetails); var ruleValidationRuleComponents = new List <RuleValidationRuleComponent>(); EntityFrameworkMocks.SetupMockDbSet( EntityFrameworkMocks.GetQueryableMockDbSet(ruleValidationRuleComponents), SchoolYearDbContextMock, x => x.RuleValidationRuleComponents, x => x.RuleValidationRuleComponents = It.IsAny <DbSet <RuleValidationRuleComponent> >(), ruleValidationRuleComponents); SchoolYearDbContextMock.As <IDisposable>().Setup(x => x.Dispose()); SchoolYearDbContextFactoryMock .Setup(x => x.CreateWithParameter(It.IsAny <string>())) .Returns(SchoolYearDbContextMock.Object); }