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


C# DummyClass类代码示例

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


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

示例1: EndMemberAssignsInstanceToParentProperty

        public void EndMemberAssignsInstanceToParentProperty()
        {
            var state = new StackingLinkedList<Level>();

            var dummyClass = new DummyClass();
            var xamlType = WiringContext.TypeContext.GetXamlType(dummyClass.GetType());
            state.Push(
                new Level
                {
                    Instance = dummyClass,
                    XamlMember = xamlType.GetMember("Child"),
                });

            var childClass = new ChildClass();
            state.Push(
                new Level
                {
                    XamlType = xamlType,
                    Instance = childClass,
                });

            var sut = new ObjectAssembler(state, WiringContext, new TopDownValueContext());

            sut.Process(X.EndObject());

            Assert.AreEqual(1, state.Count);
            var expectedInstance = state.CurrentValue.Instance;

            Assert.AreSame(expectedInstance, dummyClass);
            Assert.AreSame(((DummyClass)expectedInstance).Child, childClass);
        }
开发者ID:rdterner,项目名称:OmniXAML,代码行数:31,代码来源:ObjectAssemblerStateCommutationTests.cs

示例2: Translate

		public static string Translate(this string translate, string defaultValue = "*NO TRANSLATION*")
		{
			var bundleClass = new DummyClass ().Class;
			var languageBundle = NSBundle.FromClass (bundleClass);
			var translatedString = languageBundle.LocalizedString(translate, defaultValue, "GMImagePicker");
			return translatedString;
		}
开发者ID:Cybrosys,项目名称:GMImagePicker.Xamarin,代码行数:7,代码来源:TranslationExtensions.cs

示例3: SetUp

		public void SetUp()
		{
			_dummyClass = new DummyClass();
			_dummyClass.PrivateField = _fooValue;
			_eventSink = new EventSink();
			_invoker = new NuGenInvoker(_dummyClass);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:NuGenInvokerTests.cs

示例4: HasFieldsNotEqualToThoseIsObsoleteButWorks

        public void HasFieldsNotEqualToThoseIsObsoleteButWorks()
        {
            var x = new DummyClass();
            Check.That(x).HasFieldsNotEqualToThose(new DummyClass(1, 2));

            // check with missing fields
            Check.That(new DummyClass()).HasFieldsNotEqualToThose(new DummyHeritance(1,2));
        }
开发者ID:tpierrain,项目名称:NFluent,代码行数:8,代码来源:ObjectFIeldsRelatedTest.cs

示例5: HasNotFieldsWithSameValuesWorks

        public void HasNotFieldsWithSameValuesWorks()
        {
            var x = new DummyClass();
            Check.That(x).HasNotFieldsWithSameValues(new DummyClass(1, 2)); 

            // check with missing fields
            Check.That(new DummyClass()).HasNotFieldsWithSameValues(new DummyHeritance(1,2));
        }
开发者ID:tpierrain,项目名称:NFluent,代码行数:8,代码来源:ObjectFIeldsRelatedTest.cs

示例6: FormValueModelBinding_Enabled

        public IActionResult FormValueModelBinding_Enabled(DummyClass dc)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            return Ok("Data:" + dc?.SampleInt);
        }
开发者ID:ymd1223,项目名称:Mvc,代码行数:9,代码来源:ResourceFilterController.cs

示例7: Setup

        public override void Setup()
        {
            base.Setup();

            dummyClass = new DummyClass { Value = 1, Reference = "2" };
            dummyStruct = new DummyStruct { Value = 3, Reference = "4" };
            classValueWrapper = ReflectionUtility.CreateFieldWrapper(typeof(DummyClass).GetField("Value"));
            classReferenceWrapper = ReflectionUtility.CreateFieldWrapper(typeof(DummyClass).GetField("Reference"));
            structValueWrapper = ReflectionUtility.CreateFieldWrapper(typeof(DummyStruct).GetField("Value"));
            structReferenceWrapper = ReflectionUtility.CreateFieldWrapper(typeof(DummyStruct).GetField("Reference"));
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:11,代码来源:FieldWrapperTests.cs

示例8: IsEqualFailsIfFieldsDifferent

        public void IsEqualFailsIfFieldsDifferent()
        {
            var x = new DummyClass();

            Check.ThatCode(() =>
            {
                Check.That(x).HasFieldsWithSameValues(new DummyClass(1, 2));
            })
            .Throws<FluentCheckException>()
            .WithMessage(Environment.NewLine+ "The checked value's field 'x' does not have the expected value." + Environment.NewLine + "The checked value:" + Environment.NewLine + "\t[2]" + Environment.NewLine + "The expected value:" + Environment.NewLine + "\t[1]");
        }
开发者ID:tpierrain,项目名称:NFluent,代码行数:11,代码来源:ObjectFIeldsRelatedTest.cs

示例9: XmlSerializer_CachesSerializerForType

        public void XmlSerializer_CachesSerializerForType()
        {
            // Arrange
            var input = new DummyClass { SampleInt = 10 };
            var formatter = new TestXmlSerializerOutputFormatter();
            var context = GetOutputFormatterContext(input, typeof(DummyClass));

            // Act
            formatter.CanWriteResult(context, MediaTypeHeaderValue.Parse("application/xml"));
            formatter.CanWriteResult(context, MediaTypeHeaderValue.Parse("application/xml"));

            // Assert
            Assert.Equal(1, formatter.createSerializerCalledCount);
        }
开发者ID:4myBenefits,项目名称:Mvc,代码行数:14,代码来源:XmlSerializerOutputFormatterTest.cs

示例10: LoadWithRootInstance

        public void LoadWithRootInstance()
        {
            var dummy = new DummyClass
            {
                AnotherProperty = "Other value",
                SampleProperty = "Will be overwritten"
            };

            var loader = new XamlXmlLoader(new ObjectAssembler(WiringContext, new ObjectAssemblerSettings { RootInstance = dummy }), WiringContext);
            var actual = loader.Load("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />");

            Assert.IsInstanceOfType(actual, dummy.GetType());
            Assert.AreEqual(((DummyClass)actual).SampleProperty, "Value");
            Assert.AreEqual(((DummyClass)actual).AnotherProperty, "Other value");
        }
开发者ID:gitter-badger,项目名称:OmniXAML,代码行数:15,代码来源:SpecialTests.cs

示例11: LoadWithRootInstance

        public void LoadWithRootInstance()
        {
            var dummy = new DummyClass
            {
                AnotherProperty = "Other value",
                SampleProperty = "Will be overwritten"
            };

            var loader = new XmlLoader(new DummyParserFactory(RuntimeTypeSource));

            var actual = loader.FromString("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />", dummy);

            Assert.IsType(dummy.GetType(), actual);
            Assert.Equal("Value", ((DummyClass)actual).SampleProperty);
            Assert.Equal("Other value", ((DummyClass)actual).AnotherProperty);
        }
开发者ID:wieslawsoltes,项目名称:OmniXAML,代码行数:16,代码来源:SpecialTests.cs

示例12: LoadWithRootInstance

        public void LoadWithRootInstance()
        {
            var dummy = new DummyClass
            {
                AnotherProperty = "Other value",
                SampleProperty = "Will be overwritten"
            };

            var loader = new XamlLoader(new DummyXamlParserFactory(WiringContext));

            var actual = loader.Load("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />", dummy);

            Assert.IsInstanceOfType(actual, dummy.GetType());
            Assert.AreEqual("Value", ((DummyClass)actual).SampleProperty);
            Assert.AreEqual("Other value", ((DummyClass)actual).AnotherProperty);
        }
开发者ID:rdterner,项目名称:OmniXAML,代码行数:16,代码来源:SpecialTests.cs

示例13: GetAllPropertiesTest

		public void GetAllPropertiesTest()
		{
			DummyClass dummyClass = new DummyClass();

			PropertyInfo[] properties = EntitiyUtilities.GetAllProperties(dummyClass);

			Assert.AreEqual(3, properties.Count(), "The number of properties did not equal the expected amount.");

			bool isIntPropertyThere = properties.Any(i => i.Name == "SomeNumber");
			Assert.IsTrue(isIntPropertyThere, "The value property (int) was not handled correctly.");

			bool isStringPropertyThere = properties.Any(i => i.Name == "SomeString");
			Assert.IsTrue(isStringPropertyThere, "The reference property (string) was not handled correctly.");

			bool isComplexPropertyThere = properties.Any(i => i.Name == "SomeComplex");
			Assert.IsTrue(isComplexPropertyThere, "The complex property (List<int>) was not handled correctly.");
		}
开发者ID:tylerwal,项目名称:AmazonAlert,代码行数:17,代码来源:EntityUtilities.cs

示例14: GivenConfiguredInstance_StartMemberSetsTheMember

        public void GivenConfiguredInstance_StartMemberSetsTheMember()
        {
            var state = new StackingLinkedList<Level>();

            var dummyClass = new DummyClass();
            state.Push(
                new Level
                {
                    Instance = dummyClass,
                });

            var xamlMember = WiringContext.TypeContext.GetXamlType(dummyClass.GetType()).GetMember("Items");

            var sut = new ObjectAssembler(state, WiringContext, new TopDownValueContext());

            sut.Process(X.StartMember<DummyClass>(d => d.Items));

            Assert.AreEqual(1, state.Count);
            Assert.AreEqual(state.CurrentValue.XamlMember, xamlMember);
        }
开发者ID:grokys,项目名称:OmniXAML,代码行数:20,代码来源:ObjectAssemblerStateCommutationTests.cs

示例15: GenerateExpectedDummyObject

        public static List<DummyClass> GenerateExpectedDummyObject(int rows)
        {
            var rtnVal = new List<DummyClass>();

            for (var i = 1; i < rows + 1; i++)
            {
                var row = new DummyClass
                {
                    PropertyInt = i,
                    PropertyBool = (i % 2) == 1,
                    PropertyLong = i,
                    PropertyString = i.ToString(CultureInfo.InvariantCulture),
                    PropertyFloat = i + 0.01F,
                    PropertyDouble = i + 0.01D
                };

                rtnVal.Add(row);
            }

            return rtnVal;
        }
开发者ID:Workshop2,项目名称:TinyORM,代码行数:21,代码来源:Common.cs


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