当前位置: 首页>>代码示例>>C#>>正文


C# EmptyClass.Id方法代码示例

本文整理汇总了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());
        }
开发者ID:bazer,项目名称:Modl,代码行数:17,代码来源:EmptyClassTest.cs

示例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()));
        }
开发者ID:bazer,项目名称:Modl,代码行数:16,代码来源:ReflectionTest.cs

示例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());
        }
开发者ID:bazer,项目名称:Modl,代码行数:16,代码来源:EmptyClassTest.cs

示例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()));
        }
开发者ID:bazer,项目名称:Modl,代码行数:16,代码来源:EmptyClassTest.cs

示例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());
 }
开发者ID:bazer,项目名称:Modl,代码行数:9,代码来源:EmptyClassTest.cs

示例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());
        }
开发者ID:bazer,项目名称:Modl,代码行数:14,代码来源:EmptyClassTest.cs

示例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()));
        }
开发者ID:bazer,项目名称:Modl,代码行数:15,代码来源:EmptyClassTest.cs


注:本文中的EmptyClass.Id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。