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


C# System.TestClass类代码示例

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


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

示例1: ComplexTest

        public void ComplexTest()
        {
            var instance = new TestClass
              {
            Bar = new TestClass1
            {
              Foo = "test"
            }
              };

              var str = TypeSerializer.SerializeToString(instance);

              var jsv = new JsvConverter();

              var result = jsv.DeserializeFromString<TestClass>(str);

              Assert.AreEqual("test", result.Bar.Foo);

              var foo = new TestClass1
              {
            Foo = "test1"
              };

              var result1 = jsv.DeserializeFromString<TestClass1>(TypeSerializer.SerializeToString(foo));

              Assert.AreEqual("test1", result1.Foo);
        }
开发者ID:JulianR,项目名称:Marlee,代码行数:27,代码来源:ComplexTests.cs

示例2: Should_return_actual_objects_HashCode

		public void Should_return_actual_objects_HashCode()
		{
			const string testString = "Hello World!";
			var @class = new TestClass { TestValue = testString };
			var reader = new PropertyReader<TestClass>("TestValue");
			reader.GetItemHashCode(@class).ShouldEqual(testString.GetHashCode());
		}
开发者ID:jogibear9988,项目名称:IP.i4o,代码行数:7,代码来源:PropertyReaderTests.cs

示例3: SerializeObject_WriteJson_AreEqual

        public void SerializeObject_WriteJson_AreEqual(string value)
        {
            var source = new TestClass { HighestCsrSeasonId = new Guid(value) };
            var target = JsonConvert.SerializeObject(source);

            Assert.AreEqual($"{{\"HighestCsrSeasonId\":\"{value}\"}}", target);
        }
开发者ID:gitFurious,项目名称:HaloSharp,代码行数:7,代码来源:GuidConverterTests.cs

示例4: SetValueToNull

		public void SetValueToNull()
		{
			ReflectorMember member = ReflectorMember.Create(GetMember("InnerClass"));
			TestClass testClass = new TestClass();
			member.SetValue(testClass, null);
			Assert.IsNull(testClass.InnerClass);
		}
开发者ID:modulexcite,项目名称:NetReflector,代码行数:7,代码来源:ReflectorMemberTest.cs

示例5: FindActualPropertyWithInvalidProperty

 public void FindActualPropertyWithInvalidProperty()
 {
     TestClass testValue = new TestClass();
     testValue.Name = "My name";
     object property = DynamicValueUtility.FindActualProperty(testValue, "Name");
     Assert.IsNull(property, "Property found");
 }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:7,代码来源:DynamicValueUtilityTests.cs

示例6: OnCreate

    //int count = 1;
    //static readonly string[] Tests = new String[] {   
    //"Add Object Authorization Rules", "Test Auth Begin Edit Rules"};

    protected override void OnCreate(Bundle bundle)
    {

      base.OnCreate(bundle);

      //Intent myIntent = new Intent(this.BaseContext, (Java.Lang.Class)new UnitDriven.MainActivity().Class); 
      //myIntent.AddFlags(ActivityFlags.NewTask); 
      //StartActivity(myIntent);

      Csla.DataPortal.ProxyTypeName = "Local";

      TestClass a = new TestClass();

      ////Csla.ApplicationContext.User = new System.Security.Principal.GenericPrincipal(new System.Security.Principal.GenericIdentity(string.Empty), new string[] { });
      // Get our button from the layout resource,
      // and attach an event to it
      //btnAddObjectAuthorizationRules = FindViewById<Button>(Resource.Id.btnAddObjectAuthorizationRules);
      //lblAddObjectAuthorizationRules = FindViewById<TextView>(Resource.Id.lblAddObjectAuthorizationRules);

      //btnAddObjectAuthorizationRules.Click += delegate { CheckAddObjectAuthorizationRules(); };

      ////System.Security.Principal.GenericPrincipal dontErase = new System.Security.Principal.GenericPrincipal(new System.Security.Principal.GenericIdentity(string.Empty), new string[] { });
      ////Csla.Security.UnauthenticatedPrincipal _principal = new Csla.Security.UnauthenticatedPrincipal();

      LoadTestItems(System.Reflection.Assembly.GetExecutingAssembly());
    }
开发者ID:nschonni,项目名称:csla-svn,代码行数:30,代码来源:MainActivity.cs

示例7: SetValue

		public void SetValue()
		{
			ReflectorMember member = ReflectorMember.Create(GetMember("Name"));
			TestClass testClass = new TestClass();
			member.SetValue(testClass, "Hello");
			Assert.AreEqual("Hello", testClass.Name);
		}
开发者ID:modulexcite,项目名称:NetReflector,代码行数:7,代码来源:ReflectorMemberTest.cs

示例8: CanDisposeWithUsings

 public void CanDisposeWithUsings()
 {
   using(var myObject = new TestClass())
   {
     myObject.Should().NotBeNull();
   }
 }
开发者ID:dbuksbaum,项目名称:Hazware.Core,代码行数:7,代码来源:AbstractDisposableTests.cs

示例9: DictionaryOfObjects

        public void DictionaryOfObjects()
        {
            TestClass profileObject1 = new TestClass();
            profileObject1.Field1 = "apples";
            profileObject1.Field2 = 100;
            profileObject1.Field3 = false;

            TestClass profileObject2 = new TestClass();
            profileObject2.Field1 = "oranges";
            profileObject2.Field2 = 200;
            profileObject2.Field3 = true;

            Hashtable hash = new Hashtable();
            hash["object1"] = profileObject1;
            hash["object2"] = profileObject2;

            this.profile.SetProfile(this.ident, hash);

            IDictionary result = (IDictionary)this.profile.GetProfile(this.ident);

            Assert.AreEqual(hash.Count, result.Count, "item count");
            TestClass resultObject1 = (TestClass)result["object1"];
            Assert.AreEqual(profileObject1.Field1, resultObject1.Field1);
            Assert.AreEqual(profileObject1.Field2, resultObject1.Field2);
            Assert.AreEqual(profileObject1.Field3, resultObject1.Field3);

            TestClass resultObject2 = (TestClass)result["object2"];
            Assert.AreEqual(profileObject2.Field1, resultObject2.Field1);
            Assert.AreEqual(profileObject2.Field2, resultObject2.Field2);
            Assert.AreEqual(profileObject2.Field3, resultObject2.Field3);
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:31,代码来源:DbProfileProviderFixture.cs

示例10: Main

        private static void Main(string[] args)
        {
            var testClass = new TestClass("TestInstance");

            Console.WriteLine("Test of integer param to a method. Expected value: 5 Return Value:" + testClass.Add(2, 3));
            Console.WriteLine("Test of double  param to a method. Expected value: 4 Return Value:" + testClass.Subtract(6, 2));

            Console.WriteLine("Test of return value of a method. Expected value: TestInstance  Return Value:" + testClass.GetName());
            Console.WriteLine("Test of generic parameters to a method. Expected value: TestClass  Return Value:" + testClass.GetTypeName<TestClass>());
            Console.WriteLine("Test of generic parameters to a method. Expected value: TestClass  Return Value:" + testClass.GetTypeName<TestClass>(testClass));

            string name = "Punit", name2 = string.Empty;

            Console.WriteLine("Test of ref parameters to a method. Expected value: Punit.appended Return Value:" + testClass.GetRefValue(ref name));
            Console.WriteLine("Value of name (ref)" + name);

            Console.WriteLine("Test of out parameters to a method. Expected value: new Value Return Value:" + testClass.GetOutValue(out name2));
            Console.WriteLine("Value of name (out)" + name2);

            Console.WriteLine("Test of static method. Expected value: NewInstance Return Value:" + TestClass.Create().Name);
            Console.WriteLine("Test of array as parameter to a method. Expected value: 2 Return Value:" + testClass.GetArrayCount(new[] { "new1", "new2" }));

            Console.WriteLine("Test of optional parameter to a method. Expected value: 8 Return Value:" + testClass.AddOptional(3));
            Console.WriteLine("Test of optional parameter to a method. Expected value: 10 Return Value:" + testClass.AddOptional(3, 7));

            Console.WriteLine("Test call of delegate");

            TestClass.MyDelegate delegateDefinition = new TestClass.MyDelegate(DelegateCalled);
            testClass.CallDelegate(delegateDefinition);

            Console.WriteLine("Name is: " + testClass.NameProperty);
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
开发者ID:hermanocabral,项目名称:CodeInject,代码行数:34,代码来源:Program.cs

示例11: IsDisposedIsFalseByDefault

 public void IsDisposedIsFalseByDefault()
 {
   var myObject = new TestClass();
   myObject.Should().NotBeNull();
   myObject.IsDisposed.Should().BeFalse();
   //Assert.False(myObject.IsDisposed);
 }
开发者ID:dbuksbaum,项目名称:Hazware.Core,代码行数:7,代码来源:AbstractDisposableTests.cs

示例12: Return_TestAttribute_When_GetAttribute_Is_Called_With_Member

 public void Return_TestAttribute_When_GetAttribute_Is_Called_With_Member()
 {
     var testClass = new TestClass();
     var memberInfo = ReflectionUtility.GetMemberInfo(() => testClass.TestProperty);
     var attribute = ReflectionUtility.GetAttribute<TestAttribute>(memberInfo);
     Assert.IsNotNull(attribute);
 }
开发者ID:rdvanbuuren,项目名称:GenImport,代码行数:7,代码来源:ReflectionUtilityShould.cs

示例13: ReadOnlyProperty_instance_setter

        public void ReadOnlyProperty_instance_setter()
        {
            var instance = new TestClass();
            dynamic expando = new Expando(instance);

            expando.ReadOnlyFullName = "John Doe";
        }
开发者ID:movileanubeniamin,项目名称:kephas,代码行数:7,代码来源:ExpandoTest.cs

示例14: SetPropertyPathValue_GivenSecondLevelProperty_ReturnsCorrectValue

        public void SetPropertyPathValue_GivenSecondLevelProperty_ReturnsCorrectValue()
        {
            var test = new TestClass();
            ReflectionHelper.SetPropertyPathValue(test, "InnerTestClassObject.SomeIntProperty", 42);

            Assert.AreEqual(42, test.InnerTestClassObject.SomeIntProperty);
        }
开发者ID:liquidsnk,项目名称:Aspid,代码行数:7,代码来源:ReflectionHelperTests.cs

示例15: IfPropertyStepping

		public void IfPropertyStepping ()
		{
			var test = new TestClass ();
			if (test.OneLineProperty == "someInvalidValue6049e709-7271-41a1-bc0a-f1f1b80d4125")/*0c64d51c-40b3-4d20-b7e3-4e3e641ec52a*/
				return;
			Console.Write ("");/*ac7625ef-ebbd-4543-b7ff-c9c5d26fd8b4*/
		}
开发者ID:jgranick,项目名称:haxedevelop,代码行数:7,代码来源:BreakpointsAndStepping.cs


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