public void Get() { var id = Guid.NewGuid(); var modl = ModlReflect.New(typeof(EmptyClass), id) as EmptyClass; modl.Save(); modl = ModlReflect.Get(typeof(EmptyClass), id) as EmptyClass; Assert.Equal(typeof(EmptyClass), modl.GetType()); Assert.False(modl.IsNew()); Assert.Equal(id, modl.Id().Get <Guid>()); }
public void CreateNew() { var modl = ModlReflect.New(typeof(EmptyClass)); Assert.Equal(typeof(EmptyClass), modl.GetType()); Assert.True((modl as EmptyClass).IsNew()); var id = Guid.NewGuid(); modl = ModlReflect.New(typeof(EmptyClass), id); Assert.Equal(typeof(EmptyClass), modl.GetType()); Assert.True((modl as EmptyClass).IsNew()); Assert.True(id == (modl as EmptyClass).Id()); }
public void List() { var modl = ModlReflect.New(typeof(EmptyClass)) as EmptyClass; modl.Save(); var modl2 = ModlReflect.New(typeof(EmptyClass)) as EmptyClass; modl2.Save(); var modlList = ModlReflect.List(typeof(EmptyClass)).ToList(); Assert.NotEqual(0, modlList.Count); Assert.True(modlList.Any(x => (Guid)x == modl.Id().Get <Guid>())); Assert.True(modlList.Any(x => (Guid)x == modl2.Id().Get <Guid>())); var modlList2 = ModlReflect.List <Guid>(typeof(EmptyClass)).ToList(); Assert.NotEqual(0, modlList2.Count); Assert.True(modlList2.Any(x => x == modl.Id().Get <Guid>())); Assert.True(modlList2.Any(x => x == modl2.Id().Get <Guid>())); }