本文整理汇总了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");
}
示例2: FooTest
public void FooTest()
{
var sqlConnectionFoo = new Foo<SqlConnection>();
var oleDbConnectionFoo = new Foo<OleDbConnection>(new OleDbConnection());
IDbConnection connection = new SqlConnection();
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例7: ShouldSerializeWithCircularReferences
public void ShouldSerializeWithCircularReferences()
{
var foo = new Foo();
foo.Parent = foo;
Assert.DoesNotThrow(() => _serializer.Serialize(foo));
}
示例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));
}
示例9: ShouldReturnDefaultIfNoneStored
public void ShouldReturnDefaultIfNoneStored()
{
var foo = new Foo();
var value = NotifiableProperty.Get(foo, x => x.Age);
Assert.AreEqual(0, value);
}
示例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);
}
}
示例11: SetPropertyValue_Sets_String_Property
public void SetPropertyValue_Sets_String_Property()
{
var foo = new Foo();
foo.SetPropertyValue("StringProperty", "Hello Mvc!");
Assert.IsNotNull(foo.StringProperty);
}
示例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);
}
示例13: SetPropertyValue_Sets_Boolean_Property
public void SetPropertyValue_Sets_Boolean_Property()
{
var foo = new Foo();
foo.SetPropertyValue("BooleanProperty", true);
Assert.IsTrue(foo.BooleanProperty);
}
示例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);
}
示例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());
}