public void DeserializeRootConverter() { SomethingElse result = JsonConvert.DeserializeObject <SomethingElse>("{}", new JsonSerializerSettings { Error = (o, e) => { e.ErrorContext.Handled = true; } }); Assert.IsNull(result); }
public void ForAll() { var somethingElse = new SomethingElse(); var thing = new Something { MyIntProp = 42, MyStringProp = "ne string", MySomethingElse = somethingElse}; var inspector = Inspect.This(thing); var list = new List<object>(); inspector.ForAll(list.Add); Assert.Equal(3, list.Count); Assert.Contains(42, list); Assert.Contains("ne string", list); Assert.Contains(somethingElse, list); }
public async Task <SomethingElse> UpdateSomethingElseByIdChangeTagAsync(int id, string tag) { SomethingElse somethingElse = ctx.SomethingElses.Include(s => s.Somethings).Where(r => r.Id == id).FirstOrDefault(); if (somethingElse == null) { throw new InvalidOperationException("This SomethingElse does not exist"); } somethingElse.Tag = tag; await ctx.SaveChangesAsync(); return(somethingElse); }
public void ForAll() { var somethingElse = new SomethingElse(); var thing = new Something { MyIntProp = 42, MyStringProp = "ne string", MySomethingElse = somethingElse }; var inspector = Inspect.This(thing); var list = new List <object>(); inspector.ForAll(list.Add); Assert.Equal(3, list.Count); Assert.Contains(42, list); Assert.Contains("ne string", list); Assert.Contains(somethingElse, list); }
public async Task SaveSomethingElseAsync(SomethingElse somethingElse) { ctx.SomethingElses.Add(somethingElse); await ctx.SaveChangesAsync(); }
public void SaveSomethingElse(SomethingElse somethingElse) { ctx.SomethingElses.Add(somethingElse); ctx.SaveChanges(); }
public SomethingElse Create(string name) { return(SomethingElse.CreateNamedSomethingElse(name)); }