public static IEnumerable <OperatorActivity> GetOperatorActivities() { var odataProvider = new Mock <IOperatorActivityOdataProvider>().Object; var configuration = new MapperConfiguration(cfg => cfg.AddProfile(new ClassToDomainProfile())); var mapper = new Mapper(configuration); var repository = new OperatorActivityReadRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)), odataProvider, mapper); var result = repository.ListAsync(null, null, null).Result; return(result); }
public static OperatorActivity CreateOperatorActivity(Guid id) { var config = new MapperConfiguration(cfg => { cfg.AddProfile <DomainToClassProfile>(); cfg.AddProfile <ClassToDomainProfile>(); }); var mapper = new Mapper(config); var odataProvider = new Mock <IOperatorActivityOdataProvider>().Object; var writeRepository = new OperatorActivityWriteRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)), mapper); var readRepository = new OperatorActivityReadRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)), odataProvider, mapper); var operatorActivity = new OperatorActivity(id); operatorActivity.SetType(BlockType.Instruction); writeRepository.CreateAsync(operatorActivity).GetAwaiter().GetResult(); return(operatorActivity); }