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


C# System.Foo类代码示例

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


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

示例1: BindOther

        public void BindOther()
        {
            var foo = new Foo("123");
            var bar = new Bar(foo);

            AssertChange(foo, bar, x => x.FooDependentValue, () => foo.Value = "arbitrary");
        }
开发者ID:robhol,项目名称:StyletDependentProperty,代码行数:7,代码来源:CrossObjectBindingTests.cs

示例2: FooTest

        public void FooTest()
        {
            var sqlConnectionFoo = new Foo<SqlConnection>();
            var oleDbConnectionFoo = new Foo<OleDbConnection>(new OleDbConnection());

            IDbConnection connection = new SqlConnection();
        }
开发者ID:tambama,项目名称:LearningCsharp201,代码行数:7,代码来源:FooTests.cs

示例3: AreSetEventEnabled_disables_events

        public void AreSetEventEnabled_disables_events()
        {
            // arrange
            var prevField1 = default(string);
            var prevField2 = default(DateTime);
            var field1 = "test";
            var field2 = DateTime.UtcNow;
            storage[0] = new Dictionary<string, object>{
                {"Field1", prevField1},
                {"Field2", prevField2}
            };
            var foo = new Foo(0, dBCollectionMock.Object);

            // act
            foo.AreSetEventsEnabled = false;
            foo.Field1 = field1;
            foo.Field2 = field2;
            foo.Commit();

            // assert
            storage[0]["Field1"].Should().Be(prevField1);
            storage[0]["Field2"].Should().Be(prevField2);
            foo.Field1.Should().Be(field1);
            foo.Field2.Should().Be(field2);
        }
开发者ID:iroq,项目名称:trellis,代码行数:25,代码来源:LazyModelTests.cs

示例4: ProperContentType

 public void ProperContentType()
 {
     var content = new Foo();
     var message = new FakeConsumedMessage(content, FakeBasicDeliverEventArgs());
     var actual = message.As<Foo>();
     Assert.Equal(content, actual.Content);
 }
开发者ID:emadb,项目名称:Carrot,代码行数:7,代码来源:MessageBuilding.cs

示例5: TestPushPop

        public void TestPushPop()
        {
            var p0 = new Pool<Foo>();
            var p1 = new Pool<Foo>(1);

            var f = new Foo();
            var g = new Foo();

            p0.Push(f);
            Assert.AreEqual(1, p0.Count);
            p0.Push(g);
            Assert.AreEqual(2, p0.Count);

            p1.Push(f);
            Assert.AreEqual(1, p1.Count);
            // capacity overflow
            p1.Push(g);
            Assert.AreEqual(1, p1.Count);

            Foo g1 = p0.Pop();
            Assert.AreSame(g, g1);
            Foo f1 = p0.Pop();
            Assert.AreSame(f, f1);

            Foo f2 = p1.Pop();
            Assert.AreSame(f, f2);
            // pop underflow
            Foo g2 = p1.Pop();
            Assert.AreSame(null, g2);
        }
开发者ID:gitter-badger,项目名称:x2clr,代码行数:30,代码来源:PoolTests.cs

示例6: EqualsShouldBeTheSameAsEq

        public void EqualsShouldBeTheSameAsEq()
        {
            // Create two equal but distinct strings
            string a = new string(new char[] { 'h', 'e', 'l', 'l', 'o' });
            string b = new string(new char[] { 'h', 'e', 'l', 'l', 'o' });

            Assert.IsTrue(a == b);
            Assert.IsTrue(a.Equals(b));

            object c = a;
            object d = b;

            Assert.IsFalse(c == d);
            Assert.IsTrue(c.Equals(d));

            if(new Foo())
            {

            }
            else
            {
                Assert.Fail("should fail");
            }

            Foo foo = new Foo();
        }
开发者ID:sbendiola,项目名称:sandbox,代码行数:26,代码来源:StringComparisonTest.cs

示例7: ShouldSerializeWithCircularReferences

            public void ShouldSerializeWithCircularReferences()
            {
                var foo = new Foo();
                foo.Parent = foo;

                Assert.DoesNotThrow(() => _serializer.Serialize(foo));
            }
开发者ID:josh-bradley,项目名称:scriptcs,代码行数:7,代码来源:ObjectSerializerTests.cs

示例8: ArrayToDelimitedString

 public void ArrayToDelimitedString()
 {
     Foo[] arr = new Foo[] {new Foo("Foo"), new Foo("Bar")};
     Assert.AreEqual(
         ":Foo,:Bar", StringUtils.CollectionToCommaDelimitedString(arr));
     Assert.AreEqual("null", StringUtils.CollectionToCommaDelimitedString<object>(null));
 }
开发者ID:kog,项目名称:Solenoid-Expressions,代码行数:7,代码来源:StringUtilsTests.cs

示例9: ShouldReturnDefaultIfNoneStored

        public void ShouldReturnDefaultIfNoneStored()
        {
            var foo = new Foo();
            var value = NotifiableProperty.Get(foo, x => x.Age);

            Assert.AreEqual(0, value);
        }
开发者ID:svn2github,项目名称:azonlibrary,代码行数:7,代码来源:NotifiablePropertyTests.cs

示例10: TestSave

        public void TestSave()
        {
            var server = Configuration.TestServer;
            var database = Configuration.TestDatabase;
            var collection = Configuration.GetTestCollection<Foo>();

            var conventions = new ConventionPack();
            conventions.Add(new NamedIdMemberConvention(new[] { "FooId" }));
            ConventionRegistry.Register("test", conventions, t => t == typeof(Foo));

            var classMap = new BsonClassMap<Foo>(cm => cm.AutoMap());

            collection.RemoveAll();
            for (int i = 0; i < 10; i++)
            {
                var foo = new Foo
                {
                    FooId = ObjectId.Empty,
                    Name = string.Format("Foo-{0}", i),
                    Summary = string.Format("Summary for Foo-{0}", i)
                };
                collection.Save(foo);
                var count = collection.Count();
                Assert.AreEqual(i + 1, count);
            }
        }
开发者ID:robinNode,项目名称:mongo-csharp-driver,代码行数:26,代码来源:CSharp77Tests.cs

示例11: SetPropertyValue_Sets_String_Property

        public void SetPropertyValue_Sets_String_Property()
        {
            var foo = new Foo();
            foo.SetPropertyValue("StringProperty", "Hello Mvc!");

            Assert.IsNotNull(foo.StringProperty);
        }
开发者ID:tacoman667,项目名称:pseudo_mvc,代码行数:7,代码来源:ObjectExtensionMethodsTests.cs

示例12: SetPropertyValue_Sets_Nullable_Property

        public void SetPropertyValue_Sets_Nullable_Property()
        {
            var foo = new Foo() { NullableInt32Property = 32 };
            foo.SetPropertyValue("NullableInt32Property", null);

            Assert.IsNull(foo.NullableInt32Property);
        }
开发者ID:tacoman667,项目名称:pseudo_mvc,代码行数:7,代码来源:ObjectExtensionMethodsTests.cs

示例13: SetPropertyValue_Sets_Boolean_Property

        public void SetPropertyValue_Sets_Boolean_Property()
        {
            var foo = new Foo();
            foo.SetPropertyValue("BooleanProperty", true);

            Assert.IsTrue(foo.BooleanProperty);
        }
开发者ID:tacoman667,项目名称:pseudo_mvc,代码行数:7,代码来源:ObjectExtensionMethodsTests.cs

示例14: SetPropertyValue_Converts_String_To_Boolean_And_Sets_Value

        public void SetPropertyValue_Converts_String_To_Boolean_And_Sets_Value()
        {
            var foo = new Foo();
            foo.SetPropertyValue("BooleanProperty", "true");

            Assert.IsTrue(foo.BooleanProperty);
        }
开发者ID:tacoman667,项目名称:pseudo_mvc,代码行数:7,代码来源:ObjectExtensionMethodsTests.cs

示例15: HeaderMapping

        public void HeaderMapping()
        {
            var content = new Foo();
            const String messageId = "one-id";
            const Int64 timestamp = 123456789L;
            const String replyExchangeType = "direct";
            const String replyExchangeName = "exchange-name";
            const String replyRoutingKey = "routing-key";
            const String correlationId = "one-correlation-id";
            var replyTo = $"{replyExchangeType}://{replyExchangeName}/{replyRoutingKey}";

            var args = new BasicDeliverEventArgs
                           {
                               BasicProperties = new BasicProperties
                                                     {
                                                         MessageId = messageId,
                                                         Timestamp = new AmqpTimestamp(timestamp),
                                                         CorrelationId = correlationId,
                                                         ReplyTo = replyTo
                                                     }
                           };
            var message = new FakeConsumedMessage(content, args);
            var actual = message.To<Foo>();
            Assert.Equal(messageId, actual.Headers.MessageId);
            Assert.Equal(timestamp, actual.Headers.Timestamp);
            Assert.Equal(correlationId, actual.Headers.CorrelationId);
            Assert.Equal(replyTo, actual.Headers.ReplyConfiguration.ToString());
        }
开发者ID:naighes,项目名称:Carrot,代码行数:28,代码来源:MessageBuilding.cs


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