public void TestGetAllScenarios() { #region Test Setup _xmlDataProvider.Setup(x => x.GetAllScenarios()).Returns(new List <Scenario>() { new Scenario() { Name = "sathesh", Surname = "Mani", ScenarioID = 1 }, new Scenario() { Name = "sathesh", Surname = "Mani", ScenarioID = 2 }, new Scenario() { Name = "someone", Surname = "Mani", ScenarioID = 2 } }); #endregion ScenarioRepository scenarioRepository = new ScenarioRepository(_xmlDataProvider.Object); var scenarios = scenarioRepository.GetAllScenarios(); Assert.NotNull(scenarios); Assert.NotNull(scenarios.Count == 3); var userSathesh = scenarios.Where(x => x.Name == "sathesh").ToList(); Assert.NotNull(userSathesh.Count == 2); }
/// <summary> Konstruktor </summary> /// <param name="scenarioRepository"> Verzeichnis für alle Szenarien </param> /// <param name="scenarioName"> Titel des Szenarios </param> public TobiiViewModel(ScenarioRepository scenarioRepository, string scenarioName) { base.DisplayName = Strings.TobiiViewModel_DisplayName; _scenarioRepository = scenarioRepository ?? throw new ArgumentNullException("scenarioRepository"); scenario = _scenarioRepository.GetScenarios(scenarioName); }
public List <ScenarioDto> GetAllScenario() { using (ScenarioRepository _scenarioRepo = new ScenarioRepository()) { return(_scenarioRepo.GetAllScenario()); } }
public virtual void Install(StoryContext context) { context.AssetSource = new ResourceAssetManager(); var scenarioRepository = new ScenarioRepository(); scenarioRepository.AddScript(scenario.name, scenario.text); context.ScenarioRepository = scenarioRepository; context.VariableRepository = new TempVariableRepository(); context.ScenarioMacroRepository = new ScenarioMacroRepository(); var actorFactory = new ActorFactory <SpriteActor>(); context.ActorFactory = actorFactory; context.ScenePresenter = scenePresenter; context.ActorPresenter = actorPresenter; context.SystemSound = systemSound; audioPlayer.assetSource = context.AssetSource; context.AudioPlayer = audioPlayer; context.MessagePresenter = messagePresenter; context.SystemPresenter = scenePresenter; context.SelectionPresenter = selectionPresenter; context.MessageLogger = messageLogPresenter; }
/// <summary> Konstruktor </summary> /// /// <param name="scenarioDataFile"> Speicherort der Datei in der alle Szenarien gespeichert sind </param> public MainWindowViewModel(string scenarioDataFile) { base.DisplayName = Strings.MainWindowViewModel_DisplayName; _scenarioRepository = new ScenarioRepository(scenarioDataFile); _scenarioRepository.ScenarioAdded += this.OnScenarioAddedToRepository; _scenarioRepository.ScenarioDeleted += this.OnScenarioDeletedFromRepository; }
public void Next() { int safetyCount = 0; scenarioId++; while (true) { if (scenarioId > ScenarioRepository.Count) { break; } Scenario scenario = ScenarioRepository.FindById(scenarioId); if (Regex.IsMatch(scenario.Command, @"^\*") || Regex.IsMatch(scenario.Command, @"^\/\/")) { scenarioId++; continue; } if (CommandFunc(scenario)) { break; } safetyCount++; if (safetyCount > 1000) { Debug.LogWarning("INFINIT LOOP"); break; } } }
public void DeleteScenario(int id) { using (ScenarioRepository _scenarioRepo = new ScenarioRepository()) { _scenarioRepo.DeleteScenario(id); } }
public ScenarioDto AddScenario(ScenarioDto scenario) { using (ScenarioRepository _scenarioRepo = new ScenarioRepository()) { return(_scenarioRepo.AddScenario(scenario)); } }
public ScenarioDto GetScenario(int id) { using (ScenarioRepository _scenarioRepo = new ScenarioRepository()) { return(_scenarioRepo.GetScenario(id)); } }
/// <summary> Konstruktor </summary> /// <param name="scenarioRepository"> Verzeichnis für alle Szenarien </param> public DeleteScenarioViewModel(ScenarioRepository scenarioRepository) { _scenarioRepository = scenarioRepository; /// Registrieren des Events _scenarioRepository.ScenarioDeleted += this.OnScenarioDeletedFromRepository; IsListItemSelected = false; this.CreateAllScenarios(); }
public async void Get_ScenarioTotals_ReturnsResultForScenarioIdSpecifiedOnly() { var repository = new ScenarioRepository(_mockDbContextFactory.Object); var result = await repository.GetScenarioTotals(101); Assert.True(result.ScenarioId == 101); }
public ScenarioController(ScenarioRepository scenarioRepository, UserGroupRepository userGroupRepository, IMapper <ScenarioDTO, Scenario> mapper, ControllerScenariosRepository connections) { _scenarioRepository = scenarioRepository; _userGroupRepository = userGroupRepository; _mapper = mapper; _connections = connections; }
protected async void FormSubmit(EditContext editContext) { if (!editContext.Validate()) { return; } await ScenarioRepository.Update(Scenario); NavigationManager.NavigateTo("scenario"); }
public void GetActiveScenarios() { var serverName = "10.159.152.72"; var repository = new ScenarioRepository(serverName); var scenarios = repository.GetActiveScenarios(); foreach (var scenario in scenarios) { Console.Out.WriteLine("{0}, {1}, {2}", scenario.Id, scenario.Title, scenario.Description); } }
public void GetActiveScenarios() { var serverName = "10.159.152.72"; var repository = new ScenarioRepository(serverName); var scenarios = repository.GetActiveScenarios(); foreach (var scenario in scenarios) { Console.Out.WriteLine("{0}, {1}, {2}", scenario.Id, scenario.Title, scenario.Description); } }
protected override async Task OnInitializedAsync() { Console.WriteLine(CultureInfo.CurrentCulture); Users = UserManager.Users.ToList(); Armies = await ArmyRepository.GetList(); GameTables = await GameTableRepository.GetList(); Scenarios = await ScenarioRepository.GetList(); if (!string.IsNullOrEmpty(Player1) && !string.IsNullOrEmpty(Player2) && !string.IsNullOrEmpty(Date)) { User1Id = Player1; User2Id = Player2; // game.Date = DateTime.ParseExact(date, "dd-MM-yyyy",null); } }
public ValueController(LoginService loginService, AdminRepository adminRepository, UserRepository userRepository, ScenarioRepository scenarioRepository, ControllerRepository controllerRepository, ControllerScenariosRepository connections, UserGroupRepository userGroupRepository, UserLoginInfoRepository userLoginInfoRepository) { _adminRepository = adminRepository; _userRepository = userRepository; _scenarioRepository = scenarioRepository; _connections = connections; _userGroupRepository = userGroupRepository; _controllerRepository = controllerRepository; _loginService = loginService; _userLoginInfoRepository = userLoginInfoRepository; }
public void GetAllScenariosTest() { //Arrange _iScenarioDataProvider = new Mock <IScenarioDataProvider>(); _iScenarioDataProvider.Setup(x => x.GetAllScenarios()).Returns(new List <Scenarios.Models.Scenario>() { new Scenarios.Models.Scenario() { UserID = Guid.NewGuid().ToString() } }); //Act ScenarioRepository scenarioRepository = new ScenarioRepository(_iScenarioDataProvider.Object); var lst = scenarioRepository.GetAllScenarios(); //Assert Assert.NotNull(lst); Assert.AreEqual(lst.Count, 1); }
public void Setup() { //context var options = new DbContextOptionsBuilder <Backend.DataAccess.EFModels.earlynews_testContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; _context = new earlynews_testContext(options); //Set data in context Seed(); //Mapper _mapper = MappingData(); //LogRepo var logger = new LogRepository(_context, _mapper, _logger); //logger _logger = new Mock <ILogger>().Object; //All other repo _articleRepository = new ArticleRepository(_context, _mapper, logger, _logger); _articleRepository.DoLog = false; _articleSourceRepository = new ArticleSourceRepository(_context, _mapper, logger, _logger); _articleSourceRepository.DoLog = false; _dubiousArticleRepository = new DubiousArticleRepository(_context, _mapper, logger, _logger); _dubiousArticleRepository.DoLog = false; _eventRepository = new EventRepository(_context, _mapper, logger, _logger); _eventRepository.DoLog = false; _eventTypeRepository = new EventTypeRepository(_context, _mapper, logger, _logger); _eventTypeRepository.DoLog = false; _scenarioRepository = new ScenarioRepository(_context, _mapper, logger, _logger); _scenarioRepository.DoLog = false; }
public ScenarioController(ScenarioRepository scenarioRepository, ScenarioServices scenarioServices) { this.scenarioRepository = scenarioRepository; this.scenarioServices = scenarioServices; }
protected override async Task OnInitializedAsync() { Scenario = await ScenarioRepository.GetById(Id); }
public void Setup() { if (!isSetup) { _context = new earlynews_testContext(); if (!isLocal) { _context.connectionString = gitlabConnection; } _mapper = MappingData(); _logger = new Mock <ILogger>().Object; var logger = new LogRepository(_context, _mapper, _logger); _articleRepository = new ArticleRepository(_context, _mapper, logger, _logger); _articleSourceRepository = new ArticleSourceRepository(_context, _mapper, logger, _logger); _dubiousArticleRepository = new DubiousArticleRepository(_context, _mapper, logger, _logger); _eventRepository = new EventRepository(_context, _mapper, logger, _logger); _eventTypeRepository = new EventTypeRepository(_context, _mapper, logger, _logger); scenarioRepository = new ScenarioRepository(_context, _mapper, logger, _logger); } if (!isSetup && !isLocal) { if (!isLocal) { db = new AppDb(gitlabConnection); } else { db = new AppDb(localConnection); } isSetup = true; db.Connection.Open(); Console.WriteLine("Commande 1"); Console.WriteLine("------------------------------------------------------------"); var cmd = db.Connection.CreateCommand(); DirectoryInfo dir = new DirectoryInfo(Environment.CurrentDirectory); string path = Path.Combine(dir.Parent.Parent.Parent.FullName, "dbschema.sql"); cmd.CommandText = File.ReadAllText(path); Console.WriteLine("Commande 1 - text"); Console.WriteLine(cmd.CommandText); cmd.ExecuteNonQuery(); Console.WriteLine("Commande 2"); Console.WriteLine("------------------------------------------------------------"); MySqlCommand comm = db.Connection.CreateCommand(); path = Path.Combine(dir.Parent.Parent.Parent.FullName, "dummydata.sql"); comm.CommandText = File.ReadAllText(path); Console.WriteLine("Commande 2 - text"); Console.WriteLine(comm.CommandText); comm.ExecuteNonQuery(); db.Connection.Close(); } }
static void Main(string[] args) { /* ISce * for (int i = 0; i < 10; ++i) * { * string scenario = $"Super uber scenario {i}"; * for (int j = 0; j < 50 ; ++j) * { * string quest = $"Rescure world {j}"; * * } * } * */ SessionBornEntities context = new SessionBornEntities(); MotorollaService motorolla = new MotorollaService(); Common.Transactions.StandardTransactionScopeProvider scopeProvider = new Common.Transactions.StandardTransactionScopeProvider(); ScenarioRepository scenarioRepo = new ScenarioRepository(context); QuestRepository questRepo = new QuestRepository(context); QuestService questService = new QuestService(questRepo, motorolla, scopeProvider); IEnumerable <Quest> ciastko = questRepo.GetAll(); IEnumerable <Scenario> ciacho = scenarioRepo.GetAll(); Console.WriteLine("Scenarios:"); foreach (Scenario s in ciacho) { Console.WriteLine($"{s.ID} : {s.Name}"); } foreach (Quest q in ciastko) { if (q.ScenarioID != 1) { Console.WriteLine($"{q.ID} : {q.Name} : {q.Description} + {q.ScenarioID}"); } } //Tuple<decimal, decimal> latlong = getPoints(); //questService.CreateQuest("Kolokwium 1", "1sze Kolokwium z Unixów", 1, 2, new DateTime(2018, 01, 11), 300, latlong.Item1, latlong.Item2); //questService.CreateQuest("Kolokwium 2", "2gie Kolokwium z Unixów", 1, 2, new DateTime(2018, 03, 14), 300, latlong.Item1, latlong.Item2); //latlong = getPoints(); //questService.CreateQuest("Wykład", "Wykład z Unixów", 3, 2, new DateTime(2018, 02, 14), 20, latlong.Item1, latlong.Item2); //questService.CreateQuest("Pytania", "Pytania z próbnego egzaminu z zeszłego roku", 1, 2, new DateTime(2018, 05, 14), 200); //latlong = getPoints(); //questService.CreateQuest("Kolokwium 1", "Kolokwium z Liczb Zespolonych", 1, 3, new DateTime(2018, 2, 5), 300, latlong.Item1, latlong.Item2); //questService.CreateQuest("Kolokwium 2", "Kolokwium z Dekompozycji Jordana", 1, 3, new DateTime(2018, 3, 7), 300, latlong.Item1, latlong.Item2); //latlong = getPoints(); //questService.CreateQuest("Wykład", "Wykład z Algebry", 3, 3, new DateTime(2018, 3, 14), 20, latlong.Item1, latlong.Item2); //questService.CreateQuest("Pytania", "Pytania zdobyte od starszej grupy", 1, 3, new DateTime(2018, 6, 14), 200); //latlong = getPoints(); //questService.CreateQuest("Egzamin", "Ekstremalnie trudny egzamin z algebry", 2, 3, new DateTime(2018, 6, 15), 600); //latlong = getPoints(); //questService.CreateQuest("Kolokwium 1", "Kolokwium z Szybkiej Transformaty Fouriera", 1, 5, new DateTime(2018, 4, 5), 300, latlong.Item1, latlong.Item2); //questService.CreateQuest("Kolokwium 2", "Kolokwium z Przestrzeni Hilberta", 1, 5, new DateTime(2018, 05, 7), 300, latlong.Item1, latlong.Item2); //latlong = getPoints(); //questService.CreateQuest("Wykład", "Wykład z obowiązkową obecnością z Matematyki", 3, 3, new DateTime(2018, 05, 14), 100, latlong.Item1, latlong.Item2); //questService.CreateQuest("Pytania", "Pytania zdobyte od starszej grupy", 1, 5, new DateTime(2018, 05, 14), 200); //latlong = getPoints(); //questService.CreateQuest("Egzamin", "Prosty egzamin z matematyki", 2, 5, new DateTime(2018, 05, 14), 600); Console.ReadKey(); Tuple <decimal, decimal> getPoints() { decimal latmin = new decimal(50.030331); decimal latmax = new decimal(50.08103); decimal longimin = new decimal(19.831237); decimal longimax = new decimal(19.881936); Random rnd = new Random(); decimal lati = NextDecimal(rnd, latmin, latmax); decimal longi = NextDecimal(rnd, longimin, longimax); return(new Tuple <decimal, decimal>(lati, longi)); } }
protected override async Task OnInitializedAsync() { var scenarioId = Parameters.Get <string>("ScenarioId"); Scenario = await ScenarioRepository.GetById(int.Parse(scenarioId)); }
public ScenarioController(ScenarioRepository scenarioRepository, UserGroupRepository userGroupRepository, IMapper <ScenarioDTO, Scenario> mapper) { _scenarioRepository = scenarioRepository; _userGroupRepository = userGroupRepository; _mapper = mapper; }
static void Main(string[] args) { try { //using (var ScenGenContext = new ScenarioGeneratorModel("test user")) using (var ScenGenContext = new ScenarioGeneratorModel("test user", DateTime.Parse("2015-Sep-25"))) //using (var ScenGenContext = new ScenarioGeneratorModel("test user", @"data source=FMD-D8-3076\TRIDENTD01;initial catalog=ScenarioV6;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework", DateTime.Parse("2015-Aug-13"))) //using (var ScenGenContext = new ScenarioGeneratorModel("test user", @"data source=FMD-D8-3076\TRIDENTD01;initial catalog=ScenarioV6;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework")) { //Database.SetInitializer<ScenarioGeneratorModel>(new ScenarioGeneratorInitializer()); ScenGenContext.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); Console.WriteLine("*****Scenario Group Details List*****"); var groupDetails = ScenGenContext.ScenarioGroupDetails; foreach (ScenarioGroupDetail detail in groupDetails) { Console.WriteLine(" ::: " + detail.Representation); } ScenarioRepository ScenRep = new ScenarioRepository(ScenGenContext); var list = ScenGenContext.ScenarioGroups.Where(sg => sg.ScenarioGroupDetails.OrderBy(c => c.StartTime).FirstOrDefault().ScenarioGroupParentID == null); Console.WriteLine("*****Scenario Group List*****"); foreach (ScenarioGroup group in list) { Console.Write("GROUP ID:" + group.ScenarioGroupID); ScenarioGroupDetail detail = group.ScenarioGroupDetail; Console.Write(" ::: " + detail.Name); if (detail.ApprovedAt != null) { Console.WriteLine(" ::: Approved "); //detail.Name = detail.Name + " CHANGED!!! "; } else { Console.WriteLine(" ::: Unapproved "); //detail.ApprovedAt = DateTime.UtcNow; //detail.ApprovedBy = "approver"; } Console.WriteLine(" --- Children --- "); foreach (ScenarioGroupDetail detail2 in group.ScenarioGroupChildrenDetails) { Console.Write(detail2.ScenarioGroupID); Console.Write(" +++ " + detail2.Name); if (detail2.ApprovedAt != null) { Console.WriteLine(" +++ Approved "); detail2.Name = detail.Name + " CHANGED!!! "; } else { Console.WriteLine(" +++ Unapproved "); //detail2.ApprovedAt = DateTime.UtcNow; //detail2.ApprovedBy = "approver"; } } } //ScenarioGroup newGroup = new ScenarioGroup(); //ScenGenContext.Set<ScenarioGroup>().Add(newGroup); //ScenarioGroupDetail newGroupDetail = new ScenarioGroupDetail() { Name = "New Group 2"}; //newGroup.ScenarioGroupDetails.Add(newGroupDetail); ScenarioRepository Rep = new ScenarioRepository(ScenGenContext); if (!ScenGenContext.ReadOnlyView) Rep.SaveChanges3(); } } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", validationErrors.Entry.Entity.GetType().Name, validationErrors.Entry.State); foreach (var validationError in validationErrors.ValidationErrors) { Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } Console.ReadKey(); }
public ScenariosController(ScenarioRepository scenariosRepository) { _scenariosRepository = scenariosRepository; }
public ScenarioController(ScenarioRepository scenarioRepository, bool log = true) { _scenarioRepository = scenarioRepository; _scenarioRepository.DoLog = log; _log = log; }
public void JumpTo(string dest) { scenarioId = ScenarioRepository.FindByCommand(dest).Id; }
protected override async Task OnInitializedAsync() { Scenarios = await ScenarioRepository.GetList(); }
public void OnSelectionSelected(int index) { scenarioId += index; JumpTo(ScenarioRepository.FindById(scenarioId).Arg1); Next(); }
private bool CommandFunc(Scenario scenario) { bool breakLoop = false; switch (scenario.Command) { case "": Debug.Log("Command: [Text]"); // テキストの表示 if (string.IsNullOrEmpty(scenario.Arg4)) { sceneController.ShowNextText(scenario.Arg1, scenario.Text); } else { sceneController.ShowNextText(scenario.Arg1, scenario.Text, float.Parse(scenario.Arg4)); } // ボイスの再生 if (!string.IsNullOrEmpty(scenario.Arg2)) { if (string.IsNullOrEmpty(scenario.Arg3)) { audioManager.PlayVoice(scenario.Arg2); } else { audioManager.PlayVoice(scenario.Arg2, float.Parse(scenario.Arg3)); } } breakLoop = true; break; case "Jump": Debug.Log("Command: [Jump]"); // ジャンプ先へ移動 JumpTo(scenario.Arg1); break; case "Selection": Debug.Log("Command: [Selection]"); List <Scenario> selectionList = ScenarioRepository.GetSelections(scenarioId); // 条件を満たしていないselectionを削除 List <int> removeSelectionId = new List <int>(); foreach (Scenario selection in selectionList) { if (string.IsNullOrEmpty(selection.Arg2)) { continue; } List <string> conditionList = ConditionHelper.GetConditions(selection.Arg2); if (conditionList == null) { continue; } foreach (string condition in conditionList) { if (!ConditionHelper.IsConditionValid(condition)) { removeSelectionId.Add(selection.Id); break; } } } foreach (int i in removeSelectionId) { selectionList.RemoveAll(x => x.Id == i); } // Selectionを表示 sceneController.ShowSelections(selectionList); breakLoop = true; Debug.Log("break selection loop"); break; case "Bg": Debug.Log("Command: [Bg]"); imageManager.UpdateBackgroundImage(scenario.Arg1, scenario.Arg2); scenarioId++; break; case "BgOff": Debug.Log("Command: [BgOff]"); imageManager.RemoveLayerImage(scenario.Arg1); scenarioId++; break; case "Character": Debug.Log("Command: [Character]"); imageManager.UpdateCharacterImage(scenario.Arg1, scenario.Arg2, scenario.Arg3); scenarioId++; break; case "CharacterOff": Debug.Log("Command: [CharacterOff]"); imageManager.RemoveLayerImage(scenario.Arg1); scenarioId++; break; case "Bgm": Debug.Log("Command: [Bgm]"); if (string.IsNullOrEmpty(scenario.Arg3)) { if (string.IsNullOrEmpty(scenario.Arg2)) { audioManager.PlayBgm(scenario.Arg1); } else { audioManager.PlayBgm(scenario.Arg1, float.Parse(scenario.Arg2)); } } else { if (string.IsNullOrEmpty(scenario.Arg2)) { audioManager.PlayBgmWithStartTime(scenario.Arg1, float.Parse(scenario.Arg3)); } else { audioManager.PlayBgmWithStartTime(scenario.Arg1, float.Parse(scenario.Arg3), float.Parse(scenario.Arg2)); } } scenarioId++; break; case "BgmOff": Debug.Log("Command: [BgmOff]"); audioManager.StopBgm(); scenarioId++; break; case "Ambience": Debug.Log("Command: [Ambience]"); if (string.IsNullOrEmpty(scenario.Arg2)) { audioManager.PlayAmbience(scenario.Arg1); } else { audioManager.PlayAmbience(scenario.Arg1, float.Parse(scenario.Arg2)); } scenarioId++; break; case "AmbienceOff": Debug.Log("Command: [AmbienceOff]"); audioManager.StopAmbience(); scenarioId++; break; case "SoundEffect": Debug.Log("Command: [SoundEffect]"); if (string.IsNullOrEmpty(scenario.Arg2)) { audioManager.PlaySoundEffect(scenario.Arg1); } else { audioManager.PlaySoundEffect(scenario.Arg1, float.Parse(scenario.Arg2)); } scenarioId++; break; case "SoundEffectOff": Debug.Log("Command: [SoundEffectOff]"); audioManager.StopSoundEffect(); scenarioId++; break; case "StopAllSound": Debug.Log("Command: [StopAllSound]"); audioManager.StopAllSound(); scenarioId++; break; case "ChangeScene": Debug.Log("Command: [ChangeScene]"); SceneManager.LoadScene(scenario.Arg1); scenarioId++; break; case "Item": Debug.Log("Command: [Item]"); itemManager.ToggleItemIsOwned(scenario.Arg1, System.Convert.ToBoolean(scenario.Arg2)); scenarioId++; break; case "Param": Debug.Log("Command: [Param]"); paramManager.UpdateParam(scenario.Arg1); scenarioId++; break; case "ToEscape": Debug.Log("Command: [ToEspace]"); sceneController.ChangeToEscapeMode(); escapeManager.ToEscape(scenario.Arg1); breakLoop = true; break; default: Debug.LogWarning("Unkown command [" + scenario.Command + "]"); breakLoop = true; break; } return(breakLoop); }