• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AnItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AnItem的典型用法代码示例。如果您正苦于以下问题:C# AnItem类的具体用法?C# AnItem怎么用?C# AnItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AnItem类属于命名空间,在下文中一共展示了AnItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SettingValueTypeToDefailtRemovesDetail

 public void SettingValueTypeToDefailtRemovesDetail()
 {
     AnItem item = new AnItem();
     item.IntProperty = 3;
     item.IntProperty = 0;
     Assert.AreEqual(0, item.Details.Count);
 }
开发者ID:brianmatic,项目名称:n2cms,代码行数:7,代码来源:ContentItemTests.cs


示例2: SettingReferenceTypeToDefailtRemovesDetail

 public void SettingReferenceTypeToDefailtRemovesDetail()
 {
     AnItem item = new AnItem();
     item.StringProperty = "hello";
     item.StringProperty = string.Empty;
     Assert.AreEqual(0, item.Details.Count);
 }
开发者ID:brianmatic,项目名称:n2cms,代码行数:7,代码来源:ContentItemTests.cs


示例3: AddTo_UpdatesParentRelation

        public void AddTo_UpdatesParentRelation()
        {
            AnItem parent = new AnItem();
            AnItem child = new AnItem();

            child.AddTo(parent);
            Assert.AreEqual(parent, child.Parent);
        }
开发者ID:brianmatic,项目名称:n2cms,代码行数:8,代码来源:ContentItemTests.cs


示例4: AddTo_IsAddedToChildren

        public void AddTo_IsAddedToChildren()
        {
            AnItem parent = new AnItem();
            AnItem child = new AnItem();

            child.AddTo(parent);
            EnumerableAssert.Contains(parent.Children, child);
        }
开发者ID:brianmatic,项目名称:n2cms,代码行数:8,代码来源:ContentItemTests.cs


示例5: SettingReferenceTypeAddsDetail

 public void SettingReferenceTypeAddsDetail()
 {
     AnItem item = new AnItem();
     item.StringProperty = "hello";
     Assert.AreEqual(1, item.Details.Count);
     Assert.AreEqual("hello", item.StringProperty);
     Assert.AreEqual("hello", item.Details["StringProperty"].Value);
     Assert.AreEqual("hello", item["StringProperty"]);
 }
开发者ID:brianmatic,项目名称:n2cms,代码行数:9,代码来源:ContentItemTests.cs


示例6: SettingValueType_AddsDetail

 public void SettingValueType_AddsDetail()
 {
     AnItem item = new AnItem();
     item.IntProperty = 3;
     Assert.AreEqual(1, item.Details.Count);
     Assert.AreEqual(3, item.IntProperty);
     Assert.AreEqual(3, item.Details["IntProperty"].Value);
     Assert.AreEqual(3, item["IntProperty"]);
 }
开发者ID:brianmatic,项目名称:n2cms,代码行数:9,代码来源:ContentItemTests.cs


示例7: AddsToChildrenWhenOnlyParentIsSet

        public void AddsToChildrenWhenOnlyParentIsSet()
        {
            AnItem parent = new AnItem();
            AnItem child = new AnItem();

            child.Parent = parent;

            child.AddTo(parent);
            EnumerableAssert.Contains(parent.Children, child);
        }
开发者ID:spmason,项目名称:n2cms,代码行数:10,代码来源:ContentItemTests.cs


示例8: AddTo_CanBeAddedToNull

        public void AddTo_CanBeAddedToNull()
        {
            AnItem parent = new AnItem();
            AnItem child = new AnItem();

            child.AddTo(parent);
            Assert.AreEqual(parent, child.Parent);
            EnumerableAssert.Contains(parent.Children, child);

            child.AddTo(null);
            Assert.IsNull(child.Parent);
            EnumerableAssert.DoesntContain(parent.Children, child);
        }
开发者ID:spmason,项目名称:n2cms,代码行数:13,代码来源:ContentItemTests.cs


示例9: AddTo_IsRemovedFrom_PreviousParentChildren

        public void AddTo_IsRemovedFrom_PreviousParentChildren()
        {
            AnItem parent1 = new AnItem();
            AnItem parent2 = new AnItem();
            AnItem child = new AnItem();

            child.AddTo(parent1);
            EnumerableAssert.Contains(parent1.Children, child);
            EnumerableAssert.DoesntContain(parent2.Children, child);

            child.AddTo(parent2);
            EnumerableAssert.DoesntContain(parent1.Children, child);
            EnumerableAssert.Contains(parent2.Children, child);
        }
开发者ID:brianmatic,项目名称:n2cms,代码行数:14,代码来源:ContentItemTests.cs


示例10: Sizes_CanBeRecorded

        public void Sizes_CanBeRecorded()
        {
            AnItem item = new AnItem();

            var sizes = new ImageSizesCollection();
            sizes.Clear();

            sizes.Add(new ImageSizeElement { Name = "x", Width = 2, Height = 1, Mode = N2.Web.Drawing.ImageResizeMode.FitCenterOnTransparent });
            sizes.Add(new ImageSizeElement { Name = "y", Width = 666, Height = 444, Mode = N2.Web.Drawing.ImageResizeMode.Fill });

            item.RecordInstalledImageSizes(sizes);

            item.GetDetailCollection(InstallationManager.installationImageSizes, false)[0].ShouldBe("x=2,1,FitCenterOnTransparent");
            item.GetDetailCollection(InstallationManager.installationImageSizes, false)[1].ShouldBe("y=666,444,Fill");
        }
开发者ID:Biswo,项目名称:n2cms,代码行数:15,代码来源:ImageSizesMigrationTests.cs


示例11: AddTo_IsAppendedLast

        public void AddTo_IsAppendedLast()
        {
            AnItem parent = new AnItem();
            AnItem child1 = new AnItem();
            AnItem child2 = new AnItem();
            AnItem child3 = new AnItem();
            AnItem child4 = new AnItem();

            child1.AddTo(parent);
            child2.AddTo(parent);
            child3.AddTo(parent);
            child4.AddTo(parent);

            Assert.AreEqual(child1, parent.Children[0]);
            Assert.AreEqual(child2, parent.Children[1]);
            Assert.AreEqual(child3, parent.Children[2]);
            Assert.AreEqual(child4, parent.Children[3]);
        }
开发者ID:spmason,项目名称:n2cms,代码行数:18,代码来源:ContentItemTests.cs


示例12: AddTo_IsAppendedLast_EvenWhenSortOrder_MayIndicateOtherwise

        public void AddTo_IsAppendedLast_EvenWhenSortOrder_MayIndicateOtherwise()
        {
            AnItem parent = new AnItem();
            AnItem child1 = new AnItem();
            child1.SortOrder = 4;
            AnItem child2 = new AnItem();
            child2.SortOrder = 3;
            AnItem child3 = new AnItem();
            child3.SortOrder = 2;
            AnItem child4 = new AnItem();
            child4.SortOrder = 1;

            child1.AddTo(parent);
            child2.AddTo(parent);
            child3.AddTo(parent);
            child4.AddTo(parent);

            Assert.AreEqual(child1, parent.Children[0]);
            Assert.AreEqual(child2, parent.Children[1]);
            Assert.AreEqual(child3, parent.Children[2]);
            Assert.AreEqual(child4, parent.Children[3]);
        }
开发者ID:spmason,项目名称:n2cms,代码行数:22,代码来源:ContentItemTests.cs


示例13: Sizes_CanBeRead

        public void Sizes_CanBeRead()
        {
            AnItem item = new AnItem();

            var sizes = new ImageSizesCollection();
            sizes.Clear();

            sizes.Add(new ImageSizeElement { Name = "x", Width = 2, Height = 1, Mode = N2.Web.Drawing.ImageResizeMode.FitCenterOnTransparent });
            sizes.Add(new ImageSizeElement { Name = "y", Width = 666, Height = 444, Mode = N2.Web.Drawing.ImageResizeMode.Fill });

            item.RecordInstalledImageSizes(sizes);

            var readSizes = item.GetInstalledImageSizes().ToList();
            readSizes[0].Name.ShouldBe("x");
            readSizes[0].Width.ShouldBe(2);
            readSizes[0].Height.ShouldBe(1);
            readSizes[0].Mode.ShouldBe(N2.Web.Drawing.ImageResizeMode.FitCenterOnTransparent);
            readSizes[1].Name.ShouldBe("y");
            readSizes[1].Width.ShouldBe(666);
            readSizes[1].Height.ShouldBe(444);
            readSizes[1].Mode.ShouldBe(N2.Web.Drawing.ImageResizeMode.Fill);
        }
开发者ID:Biswo,项目名称:n2cms,代码行数:22,代码来源:ImageSizesMigrationTests.cs


示例14: SetDetail_ToString_AddsStringDetail

        public void SetDetail_ToString_AddsStringDetail()
        {
            AnItem item = new AnItem();

            item.SetDetailAccessor("ADetail", "hello");

            Assert.That(item.Details["ADetail"].ValueType, Is.EqualTo(typeof(string)));
            Assert.That(item.Details["ADetail"].ValueTypeKey, Is.EqualTo(ContentDetail.TypeKeys.StringType));
        }
开发者ID:jhang,项目名称:n2cms,代码行数:9,代码来源:ContentItemTests.cs


示例15: SetDetail_ToBoolean_WithSameValueAsDefault_DoesntAddDetail_True

        public void SetDetail_ToBoolean_WithSameValueAsDefault_DoesntAddDetail_True()
        {
            AnItem item = new AnItem();

            item.SetDetailAccessor("ADetail", true, true);

            Assert.That(item.Details.ContainsKey("ADetail"), Is.False);
        }
开发者ID:jhang,项目名称:n2cms,代码行数:8,代码来源:ContentItemTests.cs


示例16: SetDetail_ToBoolean_AddsBooleanDetail

        public void SetDetail_ToBoolean_AddsBooleanDetail()
        {
            AnItem item = new AnItem();

            item.SetDetailAccessor("ADetail", false);

            Assert.That(item.Details["ADetail"].ValueType, Is.EqualTo(typeof(bool)));
            Assert.That(item.Details["ADetail"].ValueTypeKey, Is.EqualTo(ContentDetail.TypeKeys.BoolType));
        }
开发者ID:jhang,项目名称:n2cms,代码行数:9,代码来源:ContentItemTests.cs


示例17: DoesntAddToChildrenTwice

        public void DoesntAddToChildrenTwice()
        {
            AnItem parent = new AnItem();
            AnItem child = new AnItem();

            parent.Children.Add(child);

            child.AddTo(parent);
            Assert.AreEqual(parent, child.Parent);
            Assert.AreEqual(1, parent.Children.Count);
        }
开发者ID:jhang,项目名称:n2cms,代码行数:11,代码来源:ContentItemTests.cs


示例18: OneVersionOf_InverseComparedToNull

        public void OneVersionOf_InverseComparedToNull()
        {
            var item = new AnItem();
            var version = new AnItem { ID = 2 };
            item.VersionOf = version;

            (item.VersionOf != null).ShouldBe(true);
            (item.VersionOf != version).ShouldBe(false);
        }
开发者ID:brianmatic,项目名称:n2cms,代码行数:9,代码来源:ContentItemTests.cs


示例19: SetDetail_ToString_WithSameValueAsDefault_DoesntAddDetail

        public void SetDetail_ToString_WithSameValueAsDefault_DoesntAddDetail()
        {
            AnItem item = new AnItem();

            item.SetDetailAccessor("ADetail", "howdy", "howdy");

            Assert.That(item.Details.ContainsKey("ADetail"), Is.False);
        }
开发者ID:jhang,项目名称:n2cms,代码行数:8,代码来源:ContentItemTests.cs


示例20: SetDetail_ToBoolean_AddsBooleanDetail

        public void SetDetail_ToBoolean_AddsBooleanDetail()
        {
            AnItem item = new AnItem();

            item.SetDetailAccessor("ADetail", false);

            Assert.That(item.Details["ADetail"], Is.TypeOf<BooleanDetail>());
        }
开发者ID:spmason,项目名称:n2cms,代码行数:8,代码来源:ContentItemTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AnalysisContext类代码示例发布时间:2022-05-24
下一篇:
C# Amount类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap