本文整理汇总了C#中EmptyClass.Id方法的典型用法代码示例。如果您正苦于以下问题:C# EmptyClass.Id方法的具体用法?C# EmptyClass.Id怎么用?C# EmptyClass.Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmptyClass
的用法示例。
在下文中一共展示了EmptyClass.Id方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateId
public void GenerateId()
{
var testClass = new EmptyClass();
var id = testClass.Id().Get();
Assert.NotNull(id);
Assert.True(id is Guid);
Assert.NotEqual(Guid.Empty, id);
//testClass.Id().Generate();
Assert.NotEqual(id, testClass.Id());
Assert.NotNull(testClass.Id());
Assert.True(testClass.Id().Get() is Guid);
Assert.False(Guid.Empty == testClass.Id());
Assert.True(testClass.IsNew());
Assert.False(testClass.IsModified());
}
示例2: GetAll
public void GetAll()
{
foreach (var m in ModlReflect.GetAll(typeof(EmptyClass)).Select(x => x as EmptyClass))
m.Delete();
var modlList = ModlReflect.GetAll(typeof(EmptyClass)).ToList();
Assert.Equal(0, modlList.Count);
var modl = new EmptyClass().Save();
var modl2 = new EmptyClass().Save();
var modlList2 = ModlReflect.GetAll(typeof(EmptyClass)).Select(x => x as EmptyClass).ToList();
Assert.Equal(2, modlList2.Count);
Assert.True(modlList2.Any(x => x.Id() == modl.Id()));
Assert.True(modlList2.Any(x => x.Id() == modl2.Id()));
}
示例3: CreateNew
public void CreateNew()
{
var testClass = new EmptyClass();
Assert.True(testClass.IsNew());
Assert.False(testClass.IsModified());
testClass = Modl<EmptyClass>.New();
Assert.True(testClass.IsNew());
Assert.False(testClass.IsModified());
var id = Guid.NewGuid();
testClass = Modl<EmptyClass>.New(id);
Assert.True(testClass.IsNew());
Assert.False(testClass.IsModified());
Assert.True(id == testClass.Id());
}
示例4: GetAll
public void GetAll()
{
foreach (var m in Modl<EmptyClass>.GetAll())
m.Delete();
var modlList = Modl<EmptyClass>.GetAll().ToList();
Assert.Equal(0, modlList.Count);
var modl = new EmptyClass().Save();
var modl2 = new EmptyClass().Save();
modlList = Modl<EmptyClass>.GetAll().ToList();
Assert.Equal(2, modlList.Count);
Assert.True(modlList.Any(x => x.Id() == modl.Id()));
Assert.True(modlList.Any(x => x.Id() == modl2.Id()));
}
示例5: SetId
public void SetId()
{
var id = Guid.NewGuid();
var testClass = new EmptyClass();
testClass.Id(id);
Assert.Equal(id, testClass.Id().Get());
Assert.True(testClass.IsNew());
Assert.False(testClass.IsModified());
}
示例6: Save
public void Save()
{
var testClass = new EmptyClass();
var id = testClass.Id();
testClass.Save();
Assert.False(testClass.IsNew());
Assert.False(testClass.IsModified());
Assert.Equal(id, testClass.Id());
var loadedTestClass = Modl<EmptyClass>.Get(id);
Assert.Equal(id, loadedTestClass.Id());
Assert.False(loadedTestClass.IsNew());
Assert.False(loadedTestClass.IsModified());
}
示例7: List
public void List()
{
var modl = new EmptyClass().Save();
var modl2 = new EmptyClass().Save();
var modlList = Modl<EmptyClass>.List().ToList();
Assert.NotEqual(0, modlList.Count);
Assert.True(modlList.Any(x => x == modl.Id()));
Assert.True(modlList.Any(x => x == modl2.Id()));
var modlList2 = Modl<EmptyClass>.List<Guid>().ToList();
Assert.NotEqual(0, modlList2.Count);
Assert.True(modlList2.Any(x => x == modl.Id()));
Assert.True(modlList2.Any(x => x == modl2.Id()));
}