public void DeserializeRootConverter()
        {
            SomethingElse result = JsonConvert.DeserializeObject <SomethingElse>("{}", new JsonSerializerSettings
            {
                Error = (o, e) => { e.ErrorContext.Handled = true; }
            });

            Assert.IsNull(result);
        }
示例#2
0
 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);
 }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 public async Task SaveSomethingElseAsync(SomethingElse somethingElse)
 {
     ctx.SomethingElses.Add(somethingElse);
     await ctx.SaveChangesAsync();
 }
示例#6
0
 public void SaveSomethingElse(SomethingElse somethingElse)
 {
     ctx.SomethingElses.Add(somethingElse);
     ctx.SaveChanges();
 }
 public SomethingElse Create(string name)
 {
     return(SomethingElse.CreateNamedSomethingElse(name));
 }