本文整理汇总了C#中ClassA类的典型用法代码示例。如果您正苦于以下问题:C# ClassA类的具体用法?C# ClassA怎么用?C# ClassA使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassA类属于命名空间,在下文中一共展示了ClassA类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Contains_ReturnsFalse_ForObjectNotInCache
public void Contains_ReturnsFalse_ForObjectNotInCache()
{
var objA = new ClassA();
var objB = new ClassA();
cache.Add(objA);
Assert.IsFalse(cache.Contains(objB));
}
示例2: AnnotateNonOwnedProperty
public void AnnotateNonOwnedProperty()
{
var targetA = new ClassA();
var targetB = new ClassB();
targetA.Annotate(() => targetB.FirstName, Suffix => "Mr");
Assert.AreEqual("Mr", targetA.Annotation<string>(() => targetB.FirstName, "Suffix"));
}
示例3: SingleIndexWithMultipleTypes
public void SingleIndexWithMultipleTypes()
{
var data = Enumerable.Range(0, 100)
.Select(i =>
{
MyBaseClass o = null;
if (i % 2 == 0)
o = new ClassA() { ClassAProperty = Guid.NewGuid().ToString() };
else
o = new ClassB() { ClassBProperty = Guid.NewGuid().ToString() };
o.Title = Guid.NewGuid().ToString();
return o;
});
var result = this._client.IndexMany(data, new SimpleBulkParameters { Refresh = true });
result.IsValid.Should().BeTrue();
result.Items.Count().Should().Be(100);
var queryResults = this._client.Search<MyBaseClass>(s => s
.From(0)
.Size(100)
.MatchAll()
.ConcreteTypeSelector((o, h) => o.classBProperty != null ? typeof(ClassB) : typeof(ClassA))
);
Assert.True(queryResults.IsValid);
Assert.True(queryResults.Documents.Any());
queryResults.Documents.OfType<ClassA>().Any().Should().BeTrue();
queryResults.Documents.OfType<ClassB>().Any().Should().BeTrue();
}
示例4: Main
static void Main(string[] args)
{
Checker check = new Checker();
ClassA try1 = new ClassA();
ClassB try2 = new ClassB();
ClassC try3 = new ClassC();
ClassD try4 = new ClassD();
MyStruct try5 = new MyStruct();
object try6 = try5;
Console.WriteLine("Analyzing ClassA type variable:");
// Анализ переменной типа ClassA
check.Check(try1);
Console.WriteLine("\nAnalyzing ClassB type variable:");
// Анализ переменной типа ClassB
check.Check(try2);
Console.WriteLine("\nAnalyzing ClassC type variable:");
// Анализ переменной типа ClassC
check.Check(try3);
Console.WriteLine("\nAnalyzing ClassD type variable:");
// Анализ переменной типа ClassD
check.Check(try4);
Console.WriteLine("\nAnalyzing MyStruct type variable:");
// Анализ переменной типа MyStruct
check.Check(try5);
Console.WriteLine("\nAnalyzing boxed MyStruct type variable:");
// Анализ упакованной
check.Check(try6);
Console.ReadKey();
}
示例5: TestGetTextProperty
public void TestGetTextProperty()
{
const string textValue = "Mock Serialized String";
var values = new List<string>
{
"Foo string 1",
"Foo string 2"
};
var obj = new ClassA
{
Foo = "Foo String",
ElementsBlobbed = textValue
};
var mockSerializer = new Mock<ITextBlobSerializer>();
TextBlobOperations.SetTextSerializer(mockSerializer.Object); // Override default JSON serializer
var obj1 = obj;
var elementsProperty = typeof (ClassA).GetProperty("Elements");
mockSerializer.Setup(serializer => serializer.Deserialize(textValue, elementsProperty.PropertyType)).Returns(() => values);
TextBlobOperations.GetTextBlobChild(obj, typeof(ClassA).GetProperty("Elements"));
Assert.AreEqual(values, obj1.Elements);
}
示例6: execute
public void execute()
{
ClassB b = new ClassB();
ClassA a = new ClassA();
b = a;
}
示例7: execute
public void execute()
{
ClassA a = new ClassA();
a.addCallBack(myCallBack);
ClassB b = new ClassB();
}
示例8: MultipleTypesUsingBaseClass
public void MultipleTypesUsingBaseClass()
{
var data = Enumerable.Range(0, 100)
.Select(i =>
{
MyBaseClass o = null;
if (i % 2 == 0)
o = new ClassA() { ClassAProperty = Guid.NewGuid().ToString() };
else
o = new ClassB() { ClassBProperty = Guid.NewGuid().ToString() };
o.Title = Guid.NewGuid().ToString();
return o;
});
var resulta = this._client.IndexMany(data.OfType<ClassA>(), new SimpleBulkParameters { Refresh = true });
var resultb = this._client.IndexMany(data.OfType<ClassB>(), new SimpleBulkParameters { Refresh = true });
var queryResults = this._client.Search<MyBaseClass>(s => s
.Types(typeof(ClassA), typeof(ClassB))
.From(0)
.Size(100)
.MatchAll()
);
Assert.True(queryResults.IsValid);
Assert.True(queryResults.Documents.Any());
queryResults.Documents.OfType<ClassA>().Any().Should().BeTrue();
queryResults.Documents.OfType<ClassB>().Any().Should().BeTrue();
}
示例9: execute
public void execute()
{
ClassA<ClassC> a = new ClassA<ClassC>();
ClassB<ClassC> b = new ClassB<ClassC>();
a = b;
}
示例10: AccessAnnotationDirectly
public void AccessAnnotationDirectly()
{
var target = new ClassA();
target.Annotation()["Tags"] = new[] {"C#", "Tests"};
CollectionAssert.AreEqual(target.Annotation<string[]>("Tags"), new[] {"C#", "Tests"});
}
示例11: T02_Dispose_Instance
public void T02_Dispose_Instance()
{
var container = new Container(defaultLifestyle: DefaultLifestyle.Singleton, log: Write);
var instance = new ClassA();
container.RegisterInstance(instance);
container.Dispose();
Assert.True(instance.IsDisposed);
}
示例12: RegisterInstanceGeneric
public void RegisterInstanceGeneric()
{
var obj = new ClassA ();
ServiceContainer.Register (obj);
Assert.That (ServiceContainer.Resolve<ClassA>(), Is.EqualTo (obj));
}
示例13: execute
public void execute()
{
ClassA a = new ClassA();
ClassB b = new ClassB();
ClassC<ClassA> ca = new ClassC<ClassA>();
ca.result(test);
}
示例14: execute
public void execute()
{
ClassA a = new ClassA();
a.addCallBack(myCallBack);
a.addActionCallBack(callbackAction);
}
示例15: RegisterInterface
public void RegisterInterface()
{
var obj = new ClassA ();
ServiceContainer.Register<InterfaceA> (obj);
Assert.That (ServiceContainer.Resolve<InterfaceA> (), Is.EqualTo (obj));
}