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


C# Filler类代码示例

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


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

示例1: ShouldAddMappingSetForGivenType

 public void ShouldAddMappingSetForGivenType()
 {
     var filler = new Filler();
     filler.Configure<Foo>();
     Assert.That(filler.MappingSets.Count(), Is.EqualTo(1));
     Assert.That(filler.MappingSets.First().Type, Is.EqualTo(typeof(Foo)));
 }
开发者ID:chrisjowen,项目名称:FillMe,代码行数:7,代码来源:FillerTests.cs

示例2: Must_support_enums_out_of_the_box

		public void Must_support_enums_out_of_the_box()
		{
			var filler = new Filler<MyClass>();
			filler.Setup()
				.OnProperty(x => x.Manual).Use(() => ManualSetupEnum.B)
				.OnProperty(x => x.Ignored).IgnoreIt();

			for (int n = 0; n < 1000; n++)
			{
				var c = filler.Create();

				Assert.IsTrue(
					c.Standard == StandardEnum.A || 
					c.Standard == StandardEnum.B || 
					c.Standard == StandardEnum.C);

				Assert.IsTrue(
					c.Numbered == NumberedEnum.A ||
					c.Numbered == NumberedEnum.B ||
					c.Numbered == NumberedEnum.C);

				Assert.IsTrue(
					c.Flags == FlagsEnum.A ||
					c.Flags == FlagsEnum.B ||
					c.Flags == FlagsEnum.C);

				Assert.IsTrue((int)c.Nasty == 0);

				Assert.IsTrue(c.Manual == ManualSetupEnum.B);

				Assert.IsTrue((int)c.Ignored == 0);
			}
		}
开发者ID:GothikX,项目名称:ObjectFiller.NET,代码行数:33,代码来源:EnumTest.cs

示例3: Main

	public static void Main ()
	{
		var r = new Random ();
		var objs = new object [9];
		var which = 0;
		var last = new Filler [Bitmaps.NumWhich];
		for (var i = 0; i < 1000000000; ++i)
		{
			var o = Bitmaps.MakeAndFill (which, objs, r.Next (2) == 0);
			objs [r.Next (objs.Length)] = o;
			last [which] = o;

			if (i % 761 == 0)
			{
				var l = last [r.Next (Bitmaps.NumWhich)];
				if (l != null)
					l.Fill (objs);
			}

			/*
			  if (i % 10007 == 0)
			  Console.WriteLine (o.GetType ().Name + " " + which);
			*/

			if (i % 5 == 0)
				objs [r.Next (objs.Length)] = null;

			if (++which >= Bitmaps.NumWhich)
				which = 0;
		}
	}
开发者ID:UCIS,项目名称:mono,代码行数:31,代码来源:descriptor-tests-driver.cs

示例4: WhenClassWithCopyConstructorIsCreatedNoExceptionShallBeThrown

        public void WhenClassWithCopyConstructorIsCreatedNoExceptionShallBeThrown()
        {
            var f = new Filler<ClassWithCopyConstructorAndNormalConstructor>();
            var cc = f.Create();

            Assert.NotNull(cc);
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:7,代码来源:CopyConstructorTest.cs

示例5: DependencyOrderingWorksWithSubclassesAsWellAsPrimitives

        public void DependencyOrderingWorksWithSubclassesAsWellAsPrimitives()
        {
            var rootObject = new Foo();
            var filler = new Filler();

            var generator = MockRepository.GenerateStub<IGenerateDummyData>();
            generator.Stub(g => g.Generate(Arg<GenerationContext>.Is.Anything)).Return("Chris");

            var dependentGenerator = MockRepository.GenerateStub<IGenerateDummyData>();
            dependentGenerator.Stub(g => g.Generate(Arg<GenerationContext>.Is.Anything))
                .Do(new GeneratorDelegate(context => string.Format("Hello {0}", context.RootAs<Foo>().Bar.Name)));

            filler.Configure<Goo>(config => config.For(goo => goo.Name).Use(dependentGenerator));
            filler.Configure<Bar>(config => config.For(goo => goo.Name).Use(generator));

            filler.Configure<Foo>(config =>
            {
                config.For(f => f.Goo).Order(2);
                config.For(f => f.Bar).Order(1);
            });

            filler.Fill(rootObject);

            Assert.That(rootObject.Goo.Name, Is.EqualTo("Hello Chris"));
        }
开发者ID:chrisjowen,项目名称:FillMe,代码行数:25,代码来源:FillingDataTests.cs

示例6: CreateMultipleInstances

        public void CreateMultipleInstances()
        {
            Filler<LibraryFillingTest.Person> filler = new Filler<LibraryFillingTest.Person>();
            IEnumerable<LibraryFillingTest.Person> pList = filler.Create(10);

            Assert.NotNull(pList);
            Assert.Equal(10, pList.Count());
        }
开发者ID:Tynamix,项目名称:ObjectFiller.NET,代码行数:8,代码来源:ObjectFillerTest.cs

示例7: Ensure_that_double_does_not_return_infinity

        public void Ensure_that_double_does_not_return_infinity()
        {
            var filler = new Filler<MyClass>();
            var myClass = filler.Create();
            Assert.False(double.IsInfinity(myClass._double));

            Assert.False(float.IsInfinity(myClass._float));
        }
开发者ID:Tynamix,项目名称:ObjectFiller.NET,代码行数:8,代码来源:DefaultDatatypeMappingsTest.cs

示例8: RecursiveFill_WithIgnoredProperties_Succeeds

        public void RecursiveFill_WithIgnoredProperties_Succeeds()
        {
            var filler = new Filler<TestParent>();
            filler.Setup().OnProperty(p => p.Child).IgnoreIt();
            var result = filler.Create();

            Assert.NotNull(result);
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:8,代码来源:ObjectFillerRecursiveTests.cs

示例9: RecursiveFill_WithFunc_Succeeds

        public void RecursiveFill_WithFunc_Succeeds()
        {
            var filler = new Filler<TestParent>();
            filler.Setup().OnProperty(p => p.Child).Use(() => new TestChild());
            var result = filler.Create();

            Assert.NotNull(result.Child);
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:8,代码来源:ObjectFillerRecursiveTests.cs

示例10: ParentShallGetFilledWithourError

        public void ParentShallGetFilledWithourError()
        {
            Filler<Parent> filler = new Filler<Parent>();

            var filledObject = filler.Create();
            Assert.NotNull(filledObject);
            Assert.NotNull(filledObject.MakeTheError);
            Assert.False(string.IsNullOrWhiteSpace(filledObject.Child.MakeTheError));
        }
开发者ID:Tynamix,项目名称:ObjectFiller.NET,代码行数:9,代码来源:Bug87ErrorWhenNameInParentIsSameAsParent.cs

示例11: Clone

 public void Clone()
 {
     var pFiller = new Filler<Identity>();
     var test = pFiller.Create();
     var clone = test.Clone();
     var compareLogic = new CompareLogic();
     var result = compareLogic.Compare(test, clone);
     Assert.True(result.AreEqual, result.DifferencesString);
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:9,代码来源:IdentityTests.cs

示例12: IfIgnoreInheritanceIsSetToTrueTheNameOfTheStudentShouldBeNull

        public void IfIgnoreInheritanceIsSetToTrueTheNameOfTheStudentShouldBeNull()
        {
            Filler<Student> filler = new Filler<Student>();
            filler.Setup().IgnoreInheritance();
            var student = filler.Create();

            Assert.Null(student.FirstName);
            Assert.NotNull(student.Class);
        }
开发者ID:Tynamix,项目名称:ObjectFiller.NET,代码行数:9,代码来源:TestIgnoranceOfInheritance.cs

示例13: Must_be_able_to_handle_inheritance_and_sealed

        public void Must_be_able_to_handle_inheritance_and_sealed()
        {
            var filler = new Filler<InheritedClass>();
            var obj = filler.Create();

            Assert.NotEqual(0, obj.NormalNumber);
            Assert.NotEqual(0, obj.OverrideNormalNumber);
            Assert.NotEqual(0, obj.SealedOverrideNormalNumber);
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:9,代码来源:PatternGeneratorTest.cs

示例14: AHashsetShouldBeGenerated

        public void AHashsetShouldBeGenerated()
        {
            Filler<HashSet<string>> filler = new Filler<HashSet<string>>();

            var hashset = filler.Create();

            Assert.NotNull(hashset);
            Assert.True(hashset.Any());
        }
开发者ID:Tynamix,项目名称:ObjectFiller.NET,代码行数:9,代码来源:Bug68HashsetCanNotBeCreated.cs

示例15: TestFillLibraryWithPocoOfABook

        public void TestFillLibraryWithPocoOfABook()
        {
            Filler<LibraryConstructorPoco> lib = new Filler<LibraryConstructorPoco>();
            lib.Setup()
                .OnProperty(x => x.Books).IgnoreIt();

            LibraryConstructorPoco filledLib = lib.Create();
            Assert.IsNotNull(filledLib.Books);
            Assert.AreEqual(1, filledLib.Books.Count);
        }
开发者ID:GothikX,项目名称:ObjectFiller.NET,代码行数:10,代码来源:LibraryFillingTest.cs


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