public void TellStoryToOldNotScary() { var sut = new Storyteller(); string actual = sut.TellStory("Linda", 8, false); Assert.AreEqual($"Hallå Linda! En gång fanns en kille som tyckte om att dansa.", actual); }
public virtual void Update() { try { ResolutionUtility.Update(); RealTime.Update(); LongEventHandler.LongEventsUpdate(out var sceneChanged); if (sceneChanged) { destroyed = true; } else if (!LongEventHandler.ShouldWaitForEvent) { Rand.EnsureStateStackEmpty(); Widgets.EnsureMousePositionStackEmpty(); SteamManager.Update(); PortraitsCache.PortraitsCacheUpdate(); AttackTargetsCache.AttackTargetsCacheStaticUpdate(); Pawn_MeleeVerbs.PawnMeleeVerbsStaticUpdate(); Storyteller.StorytellerStaticUpdate(); CaravanInventoryUtility.CaravanInventoryUtilityStaticUpdate(); uiRoot.UIRootUpdate(); if (Time.frameCount > 3 && !prefsApplied) { prefsApplied = true; Prefs.Apply(); } soundRoot.Update(); } } catch (Exception arg) { Log.Error("Root level exception in Update(): " + arg); } }
// Token: 0x0600004F RID: 79 RVA: 0x000031EC File Offset: 0x000013EC public static bool TechLevelAllowed(TechLevel level) { Storyteller storyteller = Find.Storyteller; bool flag = storyteller != null; return(!flag || StorytellerDefExtension.Get(storyteller.def).allowedTechLevels.Includes(level)); }
public async Task <IActionResult> UpdateStorytellerPost(UpdateStorytellerViewModel updateStoryteller) { if (ModelState.IsValid) { #region Initialization new storyteller Storyteller oldStoryteller = _storytellerCRUD.GetStorytellerById(updateStoryteller.Id); Storyteller newStoryteller = new Storyteller(oldStoryteller.Name, oldStoryteller.QuantityStories, oldStoryteller.Gender, SetImage(oldStoryteller, updateStoryteller), updateStoryteller.About, oldStoryteller.Age) { Id = oldStoryteller.Id, UserName = oldStoryteller.UserName, Email = oldStoryteller.Email, LockoutEnd = oldStoryteller.LockoutEnd, NormalizedEmail = oldStoryteller.NormalizedEmail, NormalizedUserName = oldStoryteller.NormalizedUserName, PasswordHash = oldStoryteller.PasswordHash, PhoneNumber = oldStoryteller.PhoneNumber, }; #endregion await _storytellerCRUD.UpdateStoryteller(newStoryteller); _logger.LogInformation($"Updated storyteller: {newStoryteller.Name}"); return(RedirectToAction("Index")); } return(View(updateStoryteller)); }
public async Task CannotCreateStorytellerIfAlreadyExists_ReturnException() { Storyteller storyteller = new Storyteller("Name", 1, true, "img.png", "About", 18) { Id = "5050241f-a600-4d64-8634-0de904c043c1", AccessFailedCount = 0, EmailConfirmed = false, PhoneNumberConfirmed = false, TwoFactorEnabled = false, LockoutEnabled = false, UserName = "******", NormalizedUserName = "******", Email = "*****@*****.**", NormalizedEmail = "*****@*****.**", PasswordHash = "Pasfjdsasd", ConcurrencyStamp = "fjjffjfjf", LockoutEnd = DateTime.Now, PhoneNumber = "885553531", SecurityStamp = "Securitystamp", }; IStorytellerCRUD storytellerService1 = new StorytellerService(); IStorytellerCRUD storytellerService2 = new StorytellerService(); IStorytellerCRUD storytellerService3 = new StorytellerService(); await storytellerService1.CreateStoryteller(storyteller); await storytellerService2.CreateStoryteller(storyteller); await storytellerService3.DeleteStorytellerById(storyteller.Id); }
public void TellStoryToOldScary() { var sut = new Storyteller(); string actual = sut.TellStory("Linda", 8, true); Assert.AreEqual($"Hallå Linda! En gång fanns en kille som egentligen var en varulv.", actual); }
public void CanCreateValidStoryteller_ReturnId() { Storyteller storyteller = new Storyteller("Name", 1, true, "img.png", "About", 18) { Id = "5050241f-a600-4d64-8634-0de904c043c1", AccessFailedCount = 0, EmailConfirmed = false, PhoneNumberConfirmed = false, TwoFactorEnabled = false, LockoutEnabled = false, UserName = "******", NormalizedUserName = "******", Email = "*****@*****.**", NormalizedEmail = "*****@*****.**", PasswordHash = "Pasfjdsasd", ConcurrencyStamp = "fjjffjfjf", LockoutEnd = DateTime.Now, PhoneNumber = "885553531", SecurityStamp = "Securitystamp", }; IStorytellerCRUD storytellerService1 = new StorytellerService(); IStorytellerCRUD storytellerService2 = new StorytellerService(); Task <string> result = storytellerService1.CreateStoryteller(storyteller); storytellerService2.DeleteStorytellerById(storyteller.Id); Assert.IsNotNull(result); Assert.IsNotNull(storyteller); Assert.AreEqual(storyteller.Id, result.Result); }
public void CannotGetStorytellerByInvalidId_ReturnException() { Storyteller storyteller = new Storyteller("Name", 0, true, "img.png", "About", 18) { Id = null, AccessFailedCount = 0, EmailConfirmed = false, PhoneNumberConfirmed = false, TwoFactorEnabled = false, LockoutEnabled = false, UserName = "******", NormalizedUserName = "******", Email = "*****@*****.**", NormalizedEmail = "*****@*****.**", PasswordHash = "Pasfjdsasd", ConcurrencyStamp = "fjjffjfjf", LockoutEnd = DateTime.Now, PhoneNumber = "885553531", SecurityStamp = "Securitystamp", }; IStorytellerCRUD storytellerService = new StorytellerService(); storytellerService.GetStorytellerById(storyteller.Id); }
public void TellStoryToYoungNotScary() { var sut = new Storyteller(); string actual = sut.TellStory("Alexander", 6, false); Assert.AreEqual($"Lyssna nu Alexander. Det var en gång en prinsessa som tyckte om att dansa.", actual); }
public async Task CannotUpdateInvalidStoryteller_ReturnException() { Storyteller storyteller = null; IStorytellerCRUD storytellerService = new StorytellerService(); await storytellerService.UpdateStoryteller(storyteller); }
public void TellStoryYoungAndScared() { Storyteller storyteller = new Storyteller(); string story = storyteller.TellStory("Peter", 3, true); string ChildrenShouldntBeScared = "Unga barn ska inte bli skrämda."; Assert.AreEqual(ChildrenShouldntBeScared, story); }
private string SetImage(Storyteller oldStoryteller, UpdateStorytellerViewModel updateStoryteller) { if (updateStoryteller.IsValidImage) { return(oldStoryteller.Image); } return("defaultImageStoryteller.jpg"); }
public Storyteller GetStorytellerById(string id) { if (id != null) { Storyteller storyteller = FindStorytellerById(id); return(storyteller); } throw new KeyNotFoundException("Storyteller not found by id"); }
void Start() { stage = this.gameObject.GetComponent <Stage>(); storyteller = this.gameObject.GetComponent <Storyteller>(); catalog = this.gameObject.GetComponent <Catalog>(); existingFeatures = new List <int>(); Capacity = 1; Population = 0; Points = 0; }
public ActionResult DetalhesNarrador(int id) { Storyteller narrador = _dbContext.Storyteller.Where(x => x.Id == id).FirstOrDefault(); if (narrador == null) { return(HttpNotFound()); } return(View(narrador)); }
public IActionResult DeleteStoryteller(string id) { Storyteller storyteller = _storytellerService.FindStorytellerById(id); if (storyteller is null) { _logger.LogInformation("Storyteller not found."); return(NotFound()); } return(PartialView(storyteller)); }
public async Task DeleteStorytellerById(string id) { if (id != null) { Storyteller storyteller = FindStorytellerById(id); if (storyteller != null) { _appDbContext.Storytellers.Remove(storyteller); await Save(); } } }
public virtual void Update() { try { ResolutionUtility.Update(); RealTime.Update(); bool flag; LongEventHandler.LongEventsUpdate(out flag); if (flag) { this.destroyed = true; } else if (!LongEventHandler.ShouldWaitForEvent) { Rand.EnsureStateStackEmpty(); Widgets.EnsureMousePositionStackEmpty(); SteamManager.Update(); PortraitsCache.PortraitsCacheUpdate(); AttackTargetsCache.AttackTargetsCacheStaticUpdate(); Pawn_MeleeVerbs.PawnMeleeVerbsStaticUpdate(); Storyteller.StorytellerStaticUpdate(); CaravanInventoryUtility.CaravanInventoryUtilityStaticUpdate(); this.uiRoot.UIRootUpdate(); if (Time.frameCount > 3 && !Root.prefsApplied) { Root.prefsApplied = true; Prefs.Apply(); } this.soundRoot.Update(); try { MemoryTracker.Update(); } catch (Exception arg) { Log.Error("Error in MemoryTracker: " + arg, false); } try { MapLeakTracker.Update(); } catch (Exception arg2) { Log.Error("Error in MapLeakTracker: " + arg2, false); } } } catch (Exception arg3) { Log.Error("Root level exception in Update(): " + arg3, false); } }
static bool Prefix(ref Storyteller __instance) { __instance.incidentQueue.IncidentQueueTick(); if (Find.TickManager.TicksGame % 1000 > RefcellRespeedConfig.currentTimeMultiplier - 1 || !DebugSettings.enableStoryteller) { return(false); } foreach (FiringIncident fi in __instance.MakeIncidentsForInterval()) { __instance.TryFire(fi); } return(false); }
public async Task <string> CreateStoryteller(Storyteller storyteller) { if (_appDbContext.Storytellers.Contains(storyteller)) { throw new Exception("The entity is has already"); } _appDbContext.Storytellers.Add(storyteller); await Save(); return(storyteller.Id); }
public void TellStoryToYoungAndNotScared() { Storyteller storyteller = new Storyteller(); string nameofchild = "Peter"; bool willbescary = false; int ageOfChild = 3; string story = storyteller.TellStory(nameofchild, ageOfChild, willbescary); string princessver = String.Format("Lyssna nu {0}. Det var en gång en prinsessa", nameofchild); string maturever = String.Format("Hallå {0}! En gång fanns en kille", nameofchild); string NotscaryContinued = "som tyckte om att dansa"; Assert.AreEqual(princessver + NotscaryContinued, story); }
public async Task <IActionResult> OnPostAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); if (ModelState.IsValid) { string imageName = AddImage(); var user = new Storyteller(Input.Name, 0, Input.Gender, imageName, Input.About, Input.Age) { UserName = Input.Name, Email = Input.Email }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); var callbackUrl = Url.Page( "/Account/ConfirmEmail", pageHandler: null, values: new { area = "Identity", userId = user.Id, code = code, returnUrl = returnUrl }, protocol: Request.Scheme); await _emailSender.SendEmailAsync(Input.Email, "Confirm your email", $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>."); if (_userManager.Options.SignIn.RequireConfirmedAccount) { return(RedirectToPage("RegisterConfirmation", new { email = Input.Email, returnUrl = returnUrl })); } else { await _signInManager.SignInAsync(user, isPersistent : false); return(LocalRedirect(returnUrl)); } } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } // If we got this far, something failed, redisplay form return(Page()); }
public void TellStoryToOldChildScary() { Storyteller storyteller = new Storyteller(); string nameofchild = "Peter"; bool willbescary = true; int ageOfChild = 9; string story = storyteller.TellStory(nameofchild, ageOfChild, willbescary); string princessver = String.Format("Lyssna nu {0}. Det var en gång en prinsessa", nameofchild); string maturever = String.Format("Hallå {0}! En gång fanns en kille", nameofchild); string scaryContinued = "som egentligen var en varul"; Assert.AreEqual(maturever + scaryContinued, story); }
private void btnTellStory_Click(object sender, EventArgs e) { try { Storyteller storyteller = new Storyteller(); int age = Convert.ToInt32(numAge.Value); tbStoryText.Text = storyteller.TellStory(tbNameOfChild.Text, age, cbScary.Checked); } catch (InvalidOperationException ioe) { MessageBox.Show("Kan inte berätta storyn för dig."); } finally { } }
public ActionResult Deletar(int id) { Storyteller narrador = _dbContext.Storyteller.SingleOrDefault(c => c.Id == id); if (narrador == null) { return(HttpNotFound()); } else { _dbContext.Storyteller.Remove(narrador); _dbContext.SaveChanges(); return(RedirectToAction("Index")); } }
public async Task <Storyteller> UpdateStoryteller(Storyteller storyteller) { if (storyteller != null) { var entry = FindStorytellerById(storyteller.Id); if (entry != null) { _appDbContext.Entry(entry).CurrentValues.SetValues(storyteller); await Save(); return(storyteller); } } throw new Exception("Storyteller cannot be empty"); }
public ClientsideSessions(ClientsideLink link) { this.link = link; this.storyteller = new Storyteller(isAuthor: false); this.decoders = new List <IStorydecoder>(); PushStorydecoder(new SessionDecoder()); this.link.SetPostHandler <ServeStory>(ServeStory.op, (post) => { var story = storyteller.Read(Decode(post)); } ); this.link.SetPostHandler <ServeStoryDelta>(ServeStoryDelta.op, (post) => { var story = storyteller.Read(post.delta); } ); }
private void btnTellStory_Click(object sender, EventArgs e) { try { Storyteller obj = new Storyteller(); tbstory.Text = obj.TellStory( tbNameOfChild.Text, Convert.ToInt32(numAge.Value), cbScary.Checked ); } catch (InvalidOperationException ex) { MessageBox.Show("I dont tell story to you"); } finally { } }
public IActionResult UpdateStoryteller(string id) { Storyteller storyteller = _storytellerCRUD.GetStorytellerById(id); if (storyteller is null) { _logger.LogInformation("Storyteller not found."); return(NotFound()); } var updateStoryteller = new UpdateStorytellerViewModel { Id = storyteller.Id, About = storyteller.About, IsValidImage = true, OldStorytellerImage = storyteller.Image, }; return(View(updateStoryteller)); }
////constructor public SModelPlaysessions(ServersideLink link, System.Action <IPeer> OnLogin, System.Action <int> OnLogout) : base(link) { this.OnLogin = OnLogin; this.OnLogout = OnLogout; this.sessionsTeller = new Storyteller <SessionPage>(null); this.playersTeller = new Storyteller <PlayerPage>(BroadcastPlayerDelta); this.peerid_to_playerid = new Dictionary <int, int>(); // this.storyteller.AddUniqueColumn<string>(COL_USERNAME, page=>{return page.username;}); this.sessionsTeller.Subscribe <SessionPage>(SessionPage.SUBOP_DiscardPeerId, session => { if (peerid_to_playerid.ContainsKey(session.ServerOnly_peerid) && peerid_to_playerid[session.ServerOnly_peerid] == session.playerid) { peerid_to_playerid.Remove(session.ServerOnly_peerid); } }); this.sessionsTeller.Subscribe <SessionPage>(SessionPage.SUBOP_MyPeerIdChanged, session => { peerid_to_playerid[session.ServerOnly_peerid] = session.playerid; }); this.LINKOPS_SetPostHandlers(); this.link.OnPeerDisconnect = (peerid => { this.BANG_LogoutPeer(peerid); }); }