public void CreateContext() { _ctx = new TestingContext(); _adp = new DbContextAdapter(_ctx); _productRepo = new Repository<Product>(_adp); _catRepo = new Repository<ProductCategory>(_adp); }
private void InitContext(TestingContext context) { context.AddPrincipalMock(); context.AddInMemoryDb(); context.AddMockLogService(); context.AddGermanCultureServiceMock(); context.AddBinaryServiceMock(); context.AddQuestionService(); context.DependencyMap[typeof(IBinaryService)] = context.GetService <BinaryService>(); }
public void SetUp() { using (TestingContext context = new TestingContext()) { TestModel model = new TestModel(); context.Set <TestModel>().Add(model); context.Entry(model).State = EntityState.Modified; entry = context.Entry(model).Property(property => property.Text); } }
private void SetUpData() { state = ObjectFactory.CreateState(); using (TestingContext context = new TestingContext()) { context.Set <State>().Add(state); context.SaveChanges(); } }
public AccountValidatorTests() { context = TestingContext.Create(); hasher = Substitute.For <IHasher>(); hasher.VerifyPassword(Arg.Any <String>(), Arg.Any <String>()).Returns(true); validator = new AccountValidator(new UnitOfWork(TestingContext.Create(), TestingContext.Mapper), hasher); context.Drop().Add(account = ObjectsFactory.CreateAccount(0)); context.SaveChanges(); }
public RoleValidatorTests() { context = new TestingContext(); validator = new RoleValidator(new UnitOfWork(context)); context.DropData(); context.Add(role = ObjectFactory.CreateRole()); context.SaveChanges(); }
public AuthorizationTests() { context = TestingContext.Create(); services = Substitute.For <IServiceProvider>(); services.GetService(typeof(IAuthorization)).Returns(Substitute.For <IAuthorization>()); services.GetService(typeof(IUnitOfWork)).Returns(_ => new UnitOfWork(TestingContext.Create())); authorization = new Authorization(Assembly.GetExecutingAssembly(), services); }
public async Task GetSpecialTag(SpecialTag specialTag) { TestingContext testingContext = new TestingContext(); SetupContext(testingContext); ITagService tagService = testingContext.GetService <TagService>(); TagDto tagDto = await tagService.GetSpecialTagAsync(specialTag); Assert.NotNull(tagDto); }
private void SetUpData() { city = ObjectFactory.CreateCity(); using (TestingContext context = new TestingContext()) { context.Set <City>().Add(city); context.SaveChanges(); } }
private void SetUpData() { account = ObjectFactory.CreateAccount(); using (TestingContext testingContext = new TestingContext()) { testingContext.Set <Account>().Add(account); testingContext.SaveChanges(); } }
public UnitOfWorkTests() { context = new TestingContext(); model = ObjectFactory.CreateTestModel(); logger = Substitute.For <IAuditLogger>(); unitOfWork = new UnitOfWork(context, logger); context.Set <TestModel>().RemoveRange(context.Set <TestModel>()); context.DropData(); }
public void when_there_is_only_one_type() { // GrammarSystem is the only type in the Samples project var path = TestingContext.FindParallelDirectory("Storyteller.Samples"); var project = Project.LoadForFolder(path); var controller = new RemoteController(project, new AppDomainSystemLauncher(project)); }
public void GasPriceComparer_for_eip1559_transactions(int feeCapX, int gasPremiumX, int feeCapY, int gasPremiumY, int headBaseFee, long headBlockNumber, int expectedResult) { long eip1559Transition = 5; TestingContext context = new TestingContext(true, eip1559Transition) .WithHeadBaseFeeNumber((UInt256)headBaseFee) .WithHeadBlockNumber(headBlockNumber); IComparer <Transaction> comparer = context.DefaultComparer; Assert1559Transactions(comparer, feeCapX, gasPremiumX, feeCapY, gasPremiumY, expectedResult); }
public void GasPriceComparer_for_legacy_transactions_1559(int gasPriceX, int gasPriceY, int headBaseFee, long headBlockNumber, int expectedResult) { long eip1559Transition = 5; TestingContext context = new TestingContext(true, eip1559Transition) .WithHeadBaseFeeNumber((UInt256)headBaseFee) .WithHeadBlockNumber(headBlockNumber); IComparer <Transaction> comparer = context.DefaultComparer; AssertLegacyTransactions(comparer, gasPriceX, gasPriceY, expectedResult); }
private void TearDownData() { using (TestingContext context = new TestingContext()) { context.Set <Privilege>().RemoveRange(context.Set <Privilege>()); context.Set <Account>().RemoveRange(context.Set <Account>()); context.Set <Role>().RemoveRange(context.Set <Role>()); context.SaveChanges(); } }
public void pretty_print_for_sample_data() { var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs"); var hierarchy = HierarchyLoader.ReadHierarchy(path); var json = JsonSerialization.ToJson(hierarchy).FormatJson(); Debug.WriteLine(json); }
public void Dispose_Context() { TestingContext testingContext = Substitute.For <TestingContext>(); testingContext.ChangeTracker.Returns(context.ChangeTracker); new AuditLogger(testingContext, 0).Dispose(); testingContext.Received().Dispose(); }
public AuditLoggerTests() { context = new TestingContext(); logger = new AuditLogger(context, 1); TestingContext dataContext = new TestingContext(); TestModel model = ObjectsFactory.CreateTestModel(); entry = dataContext.Entry <BaseModel>(dataContext.Add(model).Entity); dataContext.SaveChanges(); }
public BackgroundSteps(BackdoorDriver backdoor, ScenarioContext scenarioContext, TestingContext testingContext) { this.Backdoor = backdoor; this.ScenarioContext = scenarioContext; this.TestingContext = testingContext; this.Backdoor.SetIntegrationModeOn().Wait(); }
public void Save_Logs() { TestingContext context = Substitute.For <TestingContext>(); logger = Substitute.ForPartsOf <AuditLogger>(context); logger.Save(); context.Received().SaveChanges(); }
public LoggablePropertyTests() { Role model = new() { Id = 1 }; using DbContext context = TestingContext.Create(); context.Set <Role>().Attach(model); context.Entry(model).State = EntityState.Modified; textProperty = context.Entry(model).Property(prop => prop.Title); dateProperty = context.Entry(model).Property(prop => prop.CreationDate); }
static void Main(string[] args) { using (var context = new TestingContext()) { context.Configuration.AutoDetectChangesEnabled = false; context.Configuration.LazyLoadingEnabled = false; const int count = 10; TestServersEFE(context, count); } }
private Task <SystemRecycled> start(string projectName) { _project = new Project { ProjectPath = TestingContext.FindParallelDirectory(projectName) }; _controller = new EngineController(_project, new ProcessRunnerSystemLauncher(_project)); return(_controller.Start()); }
public LoggableEntityTests() { using (context = new TestingContext()) { context.Add(model = ObjectsFactory.CreateTestModel()); context.SaveChanges(); } context = new TestingContext(context); entry = context.Entry <BaseModel>(model); }
private void InitTestingContext(TestingContext testingContext) { testingContext.AddPrincipalMock(); testingContext.AddBinaryServiceMock(); testingContext.AddInMemoryDb(); testingContext.AddUserService(); testingContext.AddBusinessSecurityService(); testingContext.AddLogServiceMock(); testingContext.AddGermanCultureServiceMock(); testingContext.AddQuestionService(); }
public AccountServiceTests() { context = TestingContext.Create(); hasher = Substitute.For <IHasher>(); httpContext = new DefaultHttpContext(); service = new AccountService(new UnitOfWork(TestingContext.Create(), TestingContext.Mapper), hasher); hasher.HashPassword(Arg.Any <String>()).Returns(info => $"{info.Arg<String>()}Hashed"); context.Drop().Add(account = ObjectsFactory.CreateAccount(0)); context.SaveChanges(); }
public LoggableEntityTests() { using (context = TestingContext.Create()) { context.Drop().Add(model = ObjectsFactory.CreateRole(0)); context.SaveChanges(); } context = TestingContext.Create(); entry = context.Entry<AModel>(model); }
public AuditLoggerTests() { context = new TestingContext(); logger = new AuditLogger(context, 1); TestModel model = ObjectFactory.CreateTestModel(); TestingContext dataContext = new TestingContext(); entry = dataContext.Entry <BaseModel>(dataContext.Set <TestModel>().Add(model)); dataContext.Set <AuditLog>().RemoveRange(dataContext.Set <AuditLog>()); dataContext.DropData(); }
public void convert_the_top_suite_to_a_hierarchy_gets_the_specs() { var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs"); var hierarchy = HierarchyLoader.ReadHierarchy(path).ToHierarchy(); hierarchy.Specifications["embeds"].ShouldNotBeNull(); hierarchy.Specifications["sentence1"].ShouldNotBeNull(); hierarchy.Specifications["sentence2"].ShouldNotBeNull(); }
public void Resources_HasAllPermissionActionTitles() { using DbContext context = TestingContext.Create(); using Configuration configuration = new(context); configuration.Seed(); foreach (String name in context.Set <Permission>().Select(permission => permission.Action).Distinct()) { Assert.True(Resource.ForAction(name) != "", $"'{name}' action does not have a title."); } }
public AccountValidatorTests() { context = new TestingContext(); hasher = Substitute.For <IHasher>(); hasher.VerifyPassword(Arg.Any <String>(), Arg.Any <String>()).Returns(true); context.DropData(); SetUpData(); validator = new AccountValidator(new UnitOfWork(context), hasher); validator.CurrentAccountId = account.Id; }
public TaxGiven(TestingContext context) { this.context = context; }
public LoggerMustProduceInfo(TestingContext context) { this.context = context; }
public WorkProjectWhen(TestingContext context) { this.context = context; }
public InsuranceGiven(TestingContext context) { this.context = context; }
public CompanyWhen(TestingContext context) { this.context = context; }
public DepartmentGiven(TestingContext context) { this.context = context; }
public AssignmentThen(TestingContext context) { this.context = context; }
public ThenException(TestingContext context) { this.context = context; }
public CompanyPropertyGiven(TestingContext context) { this.context = context; }
public EmployeeWhen(TestingContext context) { this.context = context; }
public PerfTest(TestingContext context) { this.context = context; }