public void Extend() { var test = new TestExpando(); test.Field1 = "Value from Real Object"; test.Property1 = "ValueFromProp"; dynamic test2 = new ExpandoObject(); test2.ExField1 = "Value from Expando"; var exField2 = new string[] { "el1", "el2" }; test2.ExField2 = exField2; dynamic target = CQ.Extend(null, test); Assert.AreEqual("Value from Real Object", target.Field1, "Appended a regular object field to an expando object"); Assert.AreEqual("ValueFromProp", target.Property1, "Appended a regular object property to an expando object"); CQ.Extend(target, test2); Assert.AreEqual("Value from Expando", target.ExField1, "Appended an expando object property to an expando object"); Assert.AreEqual(exField2, target.ExField2, "Appended a regular object property to an expando object"); // Test "extending" regular objects (property copy) TestClass1 t1 = new TestClass1(); t1.Prop1 = "value1"; t1.Prop2 = "value2"; TestClass2 t2 = new TestClass2(); t2.Prop2 = "class2value2"; t2.Prop3 = "class2vlaue3"; CQ.Extend(t1, t2); Assert.AreEqual("value1", t1.Prop1, "Target prop1 unchanged"); Assert.AreEqual("class2value2", t1.Prop2, "Target prop2 updated"); }
public static void SerializeImplicit() { var obj = new TestClass2("test2"); var serializer = new BinarySerializer(); byte[] bytes; using (var memoryStream = new MemoryStream()) { serializer.Serialize(memoryStream, obj); memoryStream.Flush(); bytes = memoryStream.ToArray(); } object graph = null; using (var memoryStream = new MemoryStream(bytes)) { graph = serializer.Deserialize(memoryStream, typeof(TestClass2)); } Assert.IsNotNull(graph); Assert.IsInstanceOf<TestClass2>(obj); obj = (TestClass2) graph; Assert.AreEqual("test2", obj.Value); Assert.IsNull(obj.Parent); }
public void TryFetch_SetIsNull_ReturnsEmptySet() { var obj = new TestClass2(); var result = obj.TryFetch(o => o.Class2.Set); Assert.That(result, Is.Not.Null); Assert.That(result, Is.Empty); }
public void NegTest2() { TestClass1 tc1 = new TestClass1(); Type tpA = tc1.GetType(); EventInfo eventinfo = tpA.GetEvent("Event1"); TestClass2 tc2 = new TestClass2(); Exception e = Assert.ThrowsAny<Exception>(() => eventinfo.RemoveEventHandler(tc2, new TestForEvent1(tc1.method1))); Assert.Contains("TargetException", e.GetType().FullName); }
public void NegTest2() { TestClass1 tc1 = new TestClass1(); Type tpA = tc1.GetType(); EventInfo eventinfo = tpA.GetEvent("Event1"); TestClass2 tc2 = new TestClass2(); Exception e = Assert.ThrowsAny<Exception>(() => eventinfo.AddEventHandler(tc2, new TestForEvent1(tc1.method2))); Assert.Equal("System.Reflection.TargetException", e.GetType().FullName); }
public void OnEntry_Called_For_Base_Ctor_In_Proper_Order() { var t = new TestClass2 (true); Assert.Equal (new[] { "bool .ctor", "TestClass(bool)", "bool2 .ctor", "TestClass2(bool)" }, callsBag); }
public void Sets_value_of_id_property_when_Id_is_a_guid() { var guid = Guid.NewGuid(); var instance = new TestClass2(); mocker.GetMock<IGetNameOfIdPropertyForType>().Setup(a => a.GetNameOfIdProperty(It.IsAny<Type>())).Returns("Id"); mocker.Resolve<SetValueOfIdProperty>().SetId(instance, guid); Assert.AreEqual(guid.ToString(), instance.Id.ToString()); }
public void NegTest3() { TestClass1 tc1 = new TestClass1(); Type tpA = tc1.GetType(); EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance); TestClass2 tc2 = new TestClass2(); Assert.Throws<InvalidOperationException>(() => { eventinfo.AddEventHandler(tc2, new TestForEvent1(tc1.method2)); }); }
public static void Main() { TestInterface ti1 = new TestClass1(); ti1.TestMethod(); TestInterface ti2 = new TestClass2(); ti2.TestMethod(); OutputInterface(ti1); OutputInterface(ti2); }
public void ShouldResolveInjectedOverRegistered() { var container = new Container(); container.Register<TestInterface, TestClass>(); var injector = new TestClass2(); container.Inject<TestInterface>(injector, injectionBehaviour: InjectionBehaviour.Override); Assert.AreSame(injector, container.Resolve<TestInterface>()); }
public void CanCopyProperties() { var t1Obj = new TestClass1 { dummyInt = 0, dummyList = new List<int> { 1, 2 }, dummyString = "str", exclusivePropertyTestClass1=4, mismatchingTypeProperty=3.2 }; var t2Obj = new TestClass2 { exclusivePropertyTestClass2 = 3, mismatchingTypeProperty=5 }; Helpers.CopyProperties(t1Obj, t2Obj); Assert.Equal(t1Obj.dummyInt, t2Obj.dummyInt); Assert.Equal(t1Obj.dummyString, t2Obj.dummyString); Assert.Equal(t1Obj.dummyList, t2Obj.dummyList); Assert.Equal(t2Obj.exclusivePropertyTestClass2, 3); Assert.Equal(t2Obj.mismatchingTypeProperty, 5); }
public void ShouldResolveRegisteredAndInjected() { var container = new Container(); container.Register<TestInterface, TestClass>(); var testClass = new TestClass2(); container.Inject<TestInterface>(testClass); var instances = container.ResolveAll<TestInterface>().ToArray(); Assert.AreEqual(2, instances.Length); Assert.AreNotSame(instances[0], instances[1]); }
public void NavigateForward_NavigateToModelThatIsAlreadyInChainBeforeCurrent_ChainAfterTheTargetIsEmpty() { var kernel = NinjectBootstrapper.GetKernel(new TestModule()); var firstClassMock = new Mock<ViewModelBaseFactory<TestClass1>>(); TestClass1 instance1 = new TestClass1(); firstClassMock.Setup(x => x.Get(It.IsAny<object>())).Returns(instance1); var secondClassMock = new Mock<ViewModelBaseFactory<TestClass2>>(); TestClass2 instance2 = new TestClass2(); secondClassMock.Setup(x => x.Get(It.IsAny<object>())).Returns(instance2); var thirdClassMock = new Mock<ViewModelBaseFactory<TestClass3>>(); TestClass3 instance3 = new TestClass3(); thirdClassMock.Setup(x => x.Get(It.IsAny<object>())).Returns(instance3); var fourthClassMock = new Mock<ViewModelBaseFactory<TestClass4>>(); TestClass4 instance4 = new TestClass4(); fourthClassMock.Setup(x => x.Get(It.IsAny<object>())).Returns(instance4); var factory = new ChildrenViewModelsFactory(new List<IViewModelFactory> { firstClassMock.Object, secondClassMock.Object, thirdClassMock.Object, fourthClassMock.Object, }); kernel.Bind<IViewModelNavigator>() .To<ViewModelNavigator>() .WithConstructorArgument("childrenViewModelsFactory", factory); var nav = kernel.Get<IViewModelNavigator>(); nav.NavigateForward(instance1); nav.NavigateForward<TestClass2>(instance1, null); nav.NavigateForward<TestClass3>(instance2, null); nav.NavigateForward<TestClass4>(instance3, null); nav.NavigateForward<TestClass1>(instance4, null); FieldInfo storage = typeof(ViewModelNavigator).GetField("_storage", BindingFlags.NonPublic | BindingFlags.Instance); // ReSharper disable once PossibleNullReferenceException ViewModelStorage store = (ViewModelStorage) storage.GetValue(nav); FieldInfo order = typeof(ViewModelStorage).GetField("_navigationOrder", BindingFlags.NonPublic | BindingFlags.Instance); // ReSharper disable once PossibleNullReferenceException LinkedList<BaseViewModel> orderVal = (LinkedList<BaseViewModel>)order.GetValue(store); Assert.IsTrue(orderVal.Count == 1); }
public void NegTest2() { try { TestClass1 tc1 = new TestClass1(); Type tpA = tc1.GetType(); EventInfo eventinfo = tpA.GetEvent("Event1"); TestClass2 tc2 = new TestClass2(); eventinfo.AddEventHandler(tc2, new TestForEvent1(tc1.method2)); Assert.True(false); } catch (Exception e) { if (!e.GetType().FullName.Equals("System.Reflection.TargetException")) { Assert.True(false); } } }
public void ExtendPoco() { // Test "extending" regular objects (property copy) TestClass1 t1 = new TestClass1(); t1.Prop1 = "value1"; t1.Prop2 = "value2"; TestClass2 t2 = new TestClass2(); t2.Prop2 = "class2value2"; t2.Prop3 = "class2vlaue3"; CQ.Extend(t1, t2); Assert.AreEqual("value1", t1.Prop1, "Target prop1 unchanged"); Assert.AreEqual("class2value2", t1.Prop2, "Target prop2 updated"); }
public static void Main(string[] args) { TestClass tc1 = new TestClass(); tc1.x = 2; tc1.y = 2; TestClass2 testClass2 = new TestClass2(); testClass2.w = 7; testClass2.z = 7; tc1.testClassOneMore = testClass2; TestClass tc2 = new TestClass(); tc2.x = 2; tc2.y = 2; TestClass2 testClass3 = new TestClass2(); testClass3.w = 7; testClass3.z = 7; tc2.testClassOneMore = testClass3; object result = tc1.CompareEquals(tc2); }
public void NegTest2() { try { TestClass1 tc1 = new TestClass1(); Type tpA = tc1.GetType(); EventInfo eventinfo = tpA.GetEvent("Event1"); TestClass2 tc2 = new TestClass2(); eventinfo.RemoveEventHandler(tc2, new TestForEvent1(tc1.method1)); Assert.False(true); } catch (Exception e) { // TargetException is not defined in the OOB or Win8P, but using string comparison still seems to work if (!e.GetType().FullName.Contains("TargetException")) { Assert.False(true); } } }
public bool PosTest1() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("PosTest1:Convert to UInt64 from object 1"); try { TestClass2 objVal = new TestClass2(); ulong ulongVal = Convert.ToUInt64(objVal); if (ulongVal != UInt64.MaxValue) { TestLibrary.TestFramework.LogError("001", "the ExpectResult is not the ActualResult"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e); retVal = false; } return retVal; }
public void GenerateFilterIlTest() { // Arrange ExpressFormsFilterText target = new ExpressFormsFilterText(); DynamicMethod method = new DynamicMethod("Wow", typeof(bool), new Type[] { typeof(TestClass2) }); ILGenerator generator = method.GetILGenerator(); PropertyInfo property = typeof(TestClass2).GetProperty("Text"); Dictionary<string, string> thisFilter = new Dictionary<string, string>() { { "filterMode", Convert.ToString(TestContext.DataRow["FilterMode"]) }, { "filterText", Convert.ToString(TestContext.DataRow["FilterText"]) } }; TestClass2 argument = new TestClass2() { Text = Convert.ToString(TestContext.DataRow["ValueToMatch"]) }; // Act target.GenerateFilterIl(generator, thisFilter, property); // The method would eventually return true if it didn't encounter a reason to return false. generator.EmitReturnTrue(); object objResult = method.Invoke(null, new[] { argument }); bool result = (bool)objResult; // Assert bool expected = Convert.ToBoolean(TestContext.DataRow["Result"]); Assert.AreEqual(expected, result); }
public bool PosTest1() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("PosTest1:Convert to UInt32 from object 1"); try { TestClass2 objVal = new TestClass2(); TestIFormat iformat = new TestIFormat(); uint uintVal1 = Convert.ToUInt32(objVal, iformat); uint uintVal2 = Convert.ToUInt32(objVal, null); if (uintVal1 != UInt32.MaxValue || uintVal2 != UInt32.MinValue) { TestLibrary.TestFramework.LogError("001", "the ExpectResult is not the ActualResult"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e); retVal = false; } return retVal; }
public void TestGetValue() { var dataTable = new DataTable(); dataTable.Columns.Add("Column", typeof(int)); dataTable.Rows.Add(1); TestClass2 dataItem1 = new TestClass2(); DataRow dataItem2 = dataTable.Rows[0]; IDataReader dataItem3 = Substitute.For <IDataReader>(); TestClass dataItem4 = new TestClass(); var hierarchicalDataItem = new HierarchicalDataItem { Value = dataItem4, Parent = new HierarchicalDataItem { Value = dataItem1, Parent = new HierarchicalDataItem { Value = dataItem2, Parent = new HierarchicalDataItem { Value = dataItem3, } } } }; var factory = Substitute.For <IDataItemValueProviderFactory>(); var objectPropertyValueProvider = Substitute.For <ObjectPropertyValueProvider>(); var dataRowValueProvider = Substitute.For <DataRowValueProvider>(); var dataReaderValueProvider = Substitute.For <DataReaderValueProvider>(); var dataItemValueProvider = new DefaultDataItemValueProvider(factory) { DataItemSelfTemplate = "di" }; factory.Create(null).Returns(objectPropertyValueProvider); factory.Create(dataItem1).Returns(objectPropertyValueProvider); factory.Create(dataItem2).Returns(dataRowValueProvider); factory.Create(dataItem3).Returns(dataReaderValueProvider); factory.Create(dataItem4).Returns(objectPropertyValueProvider); ExceptionAssert.Throws <ArgumentException>(() => dataItemValueProvider.GetValue(null, hierarchicalDataItem)); ExceptionAssert.Throws <ArgumentException>(() => dataItemValueProvider.GetValue(string.Empty, hierarchicalDataItem)); ExceptionAssert.Throws <ArgumentException>(() => dataItemValueProvider.GetValue(" ", hierarchicalDataItem)); ExceptionAssert.Throws <ArgumentNullException>(() => dataItemValueProvider.GetValue("Template", null)); ExceptionAssert.Throws <ArgumentNullException>(() => dataItemValueProvider.GetValue("Template", null)); ExceptionAssert.Throws <ArgumentNullException>(() => dataItemValueProvider.GetValue("Template", null)); objectPropertyValueProvider.ClearReceivedCalls(); dataItemValueProvider.GetValue("di", hierarchicalDataItem); objectPropertyValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataRowValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataReaderValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataItemValueProvider.GetValue("Prop", hierarchicalDataItem); objectPropertyValueProvider.Received(1).GetValue("Prop", dataItem4); dataRowValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataReaderValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataItemValueProvider.DataItemSelfTemplate = "dataItem"; objectPropertyValueProvider.ClearReceivedCalls(); dataItemValueProvider.GetValue("parent:dataItem", hierarchicalDataItem); objectPropertyValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataRowValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataReaderValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataItemValueProvider.GetValue("parent:Prop", hierarchicalDataItem); objectPropertyValueProvider.Received(1).GetValue("Prop", dataItem1); dataRowValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataReaderValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); objectPropertyValueProvider.ClearReceivedCalls(); dataItemValueProvider.GetValue("parent:parent", hierarchicalDataItem); objectPropertyValueProvider.Received(1).GetValue("parent", dataItem1); dataRowValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataReaderValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); objectPropertyValueProvider.ClearReceivedCalls(); dataItemValueProvider.GetValue("parent : PARENT: Column", hierarchicalDataItem); objectPropertyValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataRowValueProvider.Received(1).GetValue("Column", dataItem2); dataReaderValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataRowValueProvider.ClearReceivedCalls(); dataItemValueProvider.GetValue("parent : PARENT :parent:Column", hierarchicalDataItem); objectPropertyValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataRowValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataReaderValueProvider.Received(1).GetValue("Column", dataItem3); hierarchicalDataItem.Value = null; dataReaderValueProvider.ClearReceivedCalls(); dataItemValueProvider.GetValue("Prop", hierarchicalDataItem); objectPropertyValueProvider.Received(1).GetValue("Prop", null); dataRowValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); dataReaderValueProvider.DidNotReceiveWithAnyArgs().GetValue(null, null); ExceptionAssert.Throws <InvalidTemplateException>(() => dataItemValueProvider.GetValue("par:Prop", hierarchicalDataItem), "Template \"par:Prop\" is invalid"); }
public TestClass(TestClass1 inner1, TestClass2 inner2, TestClass3 inner3) { Inner = inner1; Inner2 = inner2; Inner3 = inner3; }
public void Paged() { Guid TempGuid = Guid.NewGuid(); var TestObject = new Utilities.ORM.Manager.Session(); for (int x = 0; x < 100; ++x) { var TempObject = new TestClass2(); TempObject.BoolReference = true; TempObject.ByteArrayReference = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; TempObject.ByteReference = 12; TempObject.CharReference = 'v'; TempObject.DecimalReference = 1.4213m; TempObject.DoubleReference = 1.32645d; TempObject.EnumReference = TestEnum.Value2; TempObject.FloatReference = 1234.5f; TempObject.GuidReference = TempGuid; TempObject.IntReference = 145145; TempObject.LongReference = 763421; TempObject.NullStringReference = null; TempObject.ShortReference = 5423; TempObject.StringReference = "agsdpghasdg"; TestObject.Save <TestClass2, int>(TempObject); } IEnumerable <TestClass2> ItemList = TestObject.Paged <TestClass2>(); Assert.Equal(25, ItemList.Count()); foreach (TestClass2 Item in ItemList) { Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Item.ByteArrayReference); Assert.Equal(12, Item.ByteReference); Assert.Equal('v', Item.CharReference); Assert.Equal(1.4213m, Item.DecimalReference); Assert.Equal(1.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value2, Item.EnumReference); Assert.Equal(1234.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(145145, Item.IntReference); Assert.Equal(763421, Item.LongReference); Assert.Equal(null, Item.NullStringReference); Assert.Equal(5423, Item.ShortReference); Assert.Equal("agsdpghasdg", Item.StringReference); } ItemList = TestObject.Paged <TestClass2>(CurrentPage: 1); Assert.Equal(25, ItemList.Count()); foreach (TestClass2 Item in ItemList) { Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Item.ByteArrayReference); Assert.Equal(12, Item.ByteReference); Assert.Equal('v', Item.CharReference); Assert.Equal(1.4213m, Item.DecimalReference); Assert.Equal(1.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value2, Item.EnumReference); Assert.Equal(1234.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(145145, Item.IntReference); Assert.Equal(763421, Item.LongReference); Assert.Equal(null, Item.NullStringReference); Assert.Equal(5423, Item.ShortReference); Assert.Equal("agsdpghasdg", Item.StringReference); } ItemList = TestObject.Paged <TestClass2>(CurrentPage: 2); Assert.Equal(25, ItemList.Count()); foreach (TestClass2 Item in ItemList) { Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Item.ByteArrayReference); Assert.Equal(12, Item.ByteReference); Assert.Equal('v', Item.CharReference); Assert.Equal(1.4213m, Item.DecimalReference); Assert.Equal(1.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value2, Item.EnumReference); Assert.Equal(1234.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(145145, Item.IntReference); Assert.Equal(763421, Item.LongReference); Assert.Equal(null, Item.NullStringReference); Assert.Equal(5423, Item.ShortReference); Assert.Equal("agsdpghasdg", Item.StringReference); } ItemList = TestObject.Paged <TestClass2>(CurrentPage: 3); Assert.Equal(25, ItemList.Count()); foreach (TestClass2 Item in ItemList) { Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Item.ByteArrayReference); Assert.Equal(12, Item.ByteReference); Assert.Equal('v', Item.CharReference); Assert.Equal(1.4213m, Item.DecimalReference); Assert.Equal(1.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value2, Item.EnumReference); Assert.Equal(1234.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(145145, Item.IntReference); Assert.Equal(763421, Item.LongReference); Assert.Equal(null, Item.NullStringReference); Assert.Equal(5423, Item.ShortReference); Assert.Equal("agsdpghasdg", Item.StringReference); } ItemList = TestObject.Paged <TestClass2>(CurrentPage: 4); Assert.Equal(0, ItemList.Count()); }
public void TestInitialize() { IMyTestInterface myTestInterface = new Mock <IMyTestInterface>(); testClass2TestInstance = new TestClass2(myTestInterface.Object); }
/// <summary> /// 对 <see cref="Cyjb.TypeExt.IsImplicitFrom"/> 方法进行测试的辅助方法。 /// </summary> public void TestImplicitChangeTypeHelper(Func <object, Type, object> func) { object value = new object(); #region 6.1.1 标识转换 Assert.AreEqual(value, func(value, typeof(object))); value = true; Assert.AreEqual(value, func(value, typeof(bool))); value = 'A'; Assert.AreEqual(value, func(value, typeof(char))); value = (sbyte)10; Assert.AreEqual(value, func(value, typeof(sbyte))); value = (short)11; Assert.AreEqual(value, func(value, typeof(short))); value = (ushort)12; Assert.AreEqual(value, func(value, typeof(ushort))); value = (int)13; Assert.AreEqual(value, func(value, typeof(int))); value = (uint)14; Assert.AreEqual(value, func(value, typeof(uint))); value = (long)15; Assert.AreEqual(value, func(value, typeof(long))); value = (ulong)16; Assert.AreEqual(value, func(value, typeof(ulong))); value = (float)17; Assert.AreEqual(value, func(value, typeof(float))); value = (double)18; Assert.AreEqual(value, func(value, typeof(double))); value = (decimal)19; Assert.AreEqual(value, func(value, typeof(decimal))); value = new TestClass(); Assert.AreEqual(value, func(value, typeof(TestClass))); // 这里还有一点是 dynamic 和 object 是等效的,但由于在运行时 // dynamic 和 object 没有区别(参见规范 4.7 节), // 因此在判断类型转换时完全不用考虑它。 #endregion // 6.1.1 标识转换 #region 6.1.2 隐式数值转换 Assert.AreEqual((short)10, func((sbyte)10, typeof(short))); Assert.AreEqual((int)11, func((sbyte)11, typeof(int))); Assert.AreEqual((long)12, func((sbyte)12, typeof(long))); Assert.AreEqual((float)13, func((sbyte)13, typeof(float))); Assert.AreEqual((double)14, func((sbyte)14, typeof(double))); Assert.AreEqual((decimal)15, func((sbyte)15, typeof(decimal))); Assert.AreEqual((short)10, func((byte)10, typeof(short))); Assert.AreEqual((ushort)11, func((byte)11, typeof(ushort))); Assert.AreEqual((int)12, func((byte)12, typeof(int))); Assert.AreEqual((uint)13, func((byte)13, typeof(uint))); Assert.AreEqual((long)14, func((byte)14, typeof(long))); Assert.AreEqual((ulong)15, func((byte)15, typeof(ulong))); Assert.AreEqual((float)16, func((byte)16, typeof(float))); Assert.AreEqual((double)17, func((byte)17, typeof(double))); Assert.AreEqual((decimal)18, func((byte)18, typeof(decimal))); Assert.AreEqual((int)12, func((short)12, typeof(int))); Assert.AreEqual((long)14, func((short)14, typeof(long))); Assert.AreEqual((float)16, func((short)16, typeof(float))); Assert.AreEqual((double)17, func((short)17, typeof(double))); Assert.AreEqual((decimal)18, func((short)18, typeof(decimal))); Assert.AreEqual((int)12, func((ushort)12, typeof(int))); Assert.AreEqual((uint)13, func((ushort)13, typeof(uint))); Assert.AreEqual((long)14, func((ushort)14, typeof(long))); Assert.AreEqual((ulong)15, func((ushort)15, typeof(ulong))); Assert.AreEqual((float)16, func((ushort)16, typeof(float))); Assert.AreEqual((double)17, func((ushort)17, typeof(double))); Assert.AreEqual((decimal)18, func((ushort)18, typeof(decimal))); Assert.AreEqual((long)14, func((int)14, typeof(long))); Assert.AreEqual((float)16, func((int)16, typeof(float))); Assert.AreEqual((double)17, func((int)17, typeof(double))); Assert.AreEqual((decimal)18, func((int)18, typeof(decimal))); Assert.AreEqual((long)14, func((uint)14, typeof(long))); Assert.AreEqual((ulong)15, func((uint)15, typeof(ulong))); Assert.AreEqual((float)16, func((uint)16, typeof(float))); Assert.AreEqual((double)17, func((uint)17, typeof(double))); Assert.AreEqual((decimal)18, func((uint)18, typeof(decimal))); Assert.AreEqual((float)16, func((long)16, typeof(float))); Assert.AreEqual((double)17, func((long)17, typeof(double))); Assert.AreEqual((decimal)18, func((long)18, typeof(decimal))); Assert.AreEqual((float)16, func((ulong)16, typeof(float))); Assert.AreEqual((double)17, func((ulong)17, typeof(double))); Assert.AreEqual((decimal)18, func((ulong)18, typeof(decimal))); Assert.AreEqual((ushort)11, func((char)11, typeof(ushort))); Assert.AreEqual((int)12, func((char)12, typeof(int))); Assert.AreEqual((uint)13, func((char)13, typeof(uint))); Assert.AreEqual((long)14, func((char)14, typeof(long))); Assert.AreEqual((ulong)15, func((char)15, typeof(ulong))); Assert.AreEqual((float)16, func((char)16, typeof(float))); Assert.AreEqual((double)17, func((char)17, typeof(double))); Assert.AreEqual((decimal)18, func((char)18, typeof(decimal))); Assert.AreEqual((double)17, func((float)17, typeof(double))); #endregion // 6.1.2 隐式数值转换 // 6.1.3 隐式枚举转换,针对的是十进制数字文本 0,不在考虑范围内。 #region 6.1.4 可以为 null 的隐式转换 // 从 S 到 T? 的隐式转换。 Assert.AreEqual((int?)10, func((int)10, typeof(int?))); Assert.AreEqual((long?)10, func((int)10, typeof(long?))); // 从 S? 到 T? 的隐式转换。 Assert.AreEqual((int?)10, func((int?)10, typeof(int?))); Assert.AreEqual((long?)10, func((int?)10, typeof(long?))); Assert.AreEqual((long?)null, func((int?)null, typeof(long?))); #endregion // 6.1.4 可以为 null 的隐式转换 // 6.1.5 null 文本转换,不在考虑范围内。 #region 6.1.6 隐式引用转换 // 6.1.6.1 从任何 reference-type 到 object (和 dynamic)。 value = "abc"; Assert.AreEqual((object)value, func(value, typeof(object))); value = new TestClass(); Assert.AreEqual((object)value, func(value, typeof(object))); // 6.1.6.2 从任何 class-type S 到任何 class-type T(前提是 S 是从 T 派生的)。 value = new TestClass2(); Assert.AreEqual((TestClass)value, func(value, typeof(TestClass))); // 6.1.6.3 从任何 class-type S 到任何 interface-type T(前提是 S 实现了 T)。 value = new List <int>(); Assert.AreEqual((IList <int>)value, func(value, typeof(IList <int>))); // 6.1.6.4 从任何 interface-type S 到任何 interface-type T(前提是 S 是从 T 派生的)。 value = new List <int>(); Assert.AreEqual((IList)value, func(value, typeof(IList))); // 6.1.6.5 从元素类型为 SE 的 array-type S 到元素类型为 TE 的 array-type T(前提是以下所列条件均成立): // o S 和 T 只有元素类型不同。换言之,S 和 T 具有相同的维数。 // o SE 和 TE 都是 reference-type。 // o 存在从 SE 到 TE 的隐式引用转换。 value = new string[0]; Assert.AreEqual((object[])value, func(value, typeof(object[]))); value = new TestClass2[0]; Assert.AreEqual((TestClass[])value, func(value, typeof(TestClass[]))); value = new List <int> [0]; Assert.AreEqual((IList[])value, func(value, typeof(IList[]))); value = new List <string> [0]; Assert.AreEqual(value, func(value, typeof(IEnumerable <object>[]))); // 6.1.6.6 从任何 array-type 到 System.Array 及其实现的接口。 value = new int[0]; Assert.AreEqual((Array)value, func(value, typeof(Array))); value = new object[0]; Assert.AreEqual((Array)value, func(value, typeof(Array))); // 6.1.6.7 从一维数组类型 S[] 到 System.Collections.Generic.IList<T> 及其基接口 // (前提是存在从 S 到 T 的隐式标识或引用转换)。 value = new int[0]; Assert.AreEqual((IList <int>)value, func(value, typeof(IList <int>))); value = new TestClass[0][][]; Assert.AreEqual((IList <IList <TestClass>[]>)value, func(value, typeof(IList <IList <TestClass>[]>))); // 6.1.6.8 从任何 delegate-type 到 System.Delegate 及其实现的接口。 value = new Func <int>(TestMethod); Assert.AreEqual((Delegate)value, func((Delegate)value, typeof(Delegate))); // 6.1.6.9 从 null 文本到任何 reference-type,不在考虑范围内。 // 6.1.6.10 从任何 reference-type 到 reference-type T // (前提是它具有到 reference-type T0 的隐式标识或引用转换,且 T0 具有到 T 的标识转换)。 // 此条规则也可以不考虑。 // 6.1.6.11 从任何 reference-type 到接口或委托类型 T // (前提是它具有到接口或委托类型 T0 的隐式标识或引用转换,且 T0 可变化转换为T)。 // 这里的变化转换在规范的 13.1.3.2 节,就是泛型的协变和逆变。 // 协变。 value = Enumerable.Empty <string>(); Assert.AreEqual((IEnumerable <object>)value, func(value, typeof(IEnumerable <object>))); value = Enumerable.Empty <IEqualityComparer <object>[]>(); Assert.AreEqual((IEnumerable <IEqualityComparer <string>[]>)value, func(value, typeof(IEnumerable <IEqualityComparer <string>[]>))); value = Enumerable.Empty <object[][]>(); Assert.AreEqual((IEnumerable <IList <IList <object> > >)value, func(value, typeof(IEnumerable <IList <IList <object> > >))); // 逆变。 value = EqualityComparer <object> .Default; Assert.AreEqual((IEqualityComparer <string>)value, func(value, typeof(IEqualityComparer <string>))); value = EqualityComparer <IEnumerable <object>[]> .Default; Assert.AreEqual((IEqualityComparer <IEnumerable <string>[]>)value, func(value, typeof(IEqualityComparer <IEnumerable <string>[]>))); value = EqualityComparer <IList <TestClass[]> > .Default; Assert.AreEqual((IEqualityComparer <TestClass2[][]>)value, func(value, typeof(IEqualityComparer <TestClass2[][]>))); // 6.1.6.12 涉及已知为引用类型的类型参数的隐式转换。这个转换是针对类型参数 T 的,因此同样不做考虑。 #endregion // 6.1.6 隐式引用转换 #region 6.1.7 装箱转换 // 从 non-nullable-value-type 到 object。 value = (uint)10; Assert.AreEqual((object)value, func(value, typeof(object))); value = new TestStruct(); Assert.AreEqual((object)value, func(value, typeof(object))); // 从 non-nullable-value-type 到 System.ValueType。 value = 10; Assert.AreEqual((ValueType)value, func(value, typeof(ValueType))); value = new TestStruct2(); Assert.AreEqual((ValueType)value, func(value, typeof(ValueType))); // 从 non-nullable-value-type 到其实现的接口。 value = 10; Assert.AreEqual((IComparable <int>)value, func(value, typeof(IComparable <int>))); value = new TestStruct4(); Assert.AreEqual((IEnumerable <string>)value, func(value, typeof(IEnumerable <string>))); // 从 enum-type 转换为 System.Enum 类型。 value = Tristate.True; Assert.AreEqual((Enum)value, func(value, typeof(Enum))); // 从 nullable-type 到引用类型的装箱转换,如果存在从对应的 non-nullable-value-type 到该引用类型的装箱转换。 value = (uint?)10; Assert.AreEqual((object)value, func(value, typeof(object))); value = (int?)11; Assert.AreEqual((ValueType)value, func(value, typeof(ValueType))); value = (int?)null; Assert.AreEqual((ValueType)value, func(value, typeof(ValueType))); value = (int?)12; Assert.AreEqual((IComparable <int>)value, func(value, typeof(IComparable <int>))); value = (Tristate?)Tristate.True; Assert.AreEqual((Enum)value, func(value, typeof(Enum))); // 如果值类型具有到接口或委托类型 I0 的装箱转换,且 I0 变化转换为接口类型 I,则值类型具有到 I 的装箱转换。 value = new TestStruct4(); Assert.AreEqual((IEnumerable <object>)value, func(value, typeof(IEnumerable <object>))); value = (TestStruct4?)new TestStruct4(); Assert.AreEqual((IEnumerable <object>)value, func(value, typeof(IEnumerable <object>))); value = (TestStruct4?)null; Assert.AreEqual((IEnumerable <object>)value, func(value, typeof(IEnumerable <object>))); #endregion // 6.1.7 装箱转换 // 6.1.8 隐式动态转换、6.1.9 隐式常量表达式转换、6.1.10 涉及类型形参的隐式转换,不在考虑范围内。 #region 6.1.11 用户定义的隐式转换 value = new TestStruct2(); object expectedValue = (TestStruct) new TestStruct2(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct))); value = new TestStruct2(); expectedValue = (TestStruct?)new TestStruct2(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct?))); value = (TestStruct2?)new TestStruct2(); expectedValue = (TestStruct?)(TestStruct2?)new TestStruct2(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct?))); value = (TestStruct2?)null; Assert.AreEqual((TestStruct?)value, func(value, typeof(TestStruct?))); value = new TestStruct3(); expectedValue = (TestStruct) new TestStruct3(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct))); value = new TestStruct3(); expectedValue = (TestStruct?)new TestStruct3(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct?))); value = (TestStruct3?)new TestStruct3(); expectedValue = (TestStruct?)(TestStruct3?)new TestStruct3(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct?))); value = (TestStruct3?)null; Assert.AreEqual(value, func(value, typeof(TestStruct?))); value = new TestStruct5(); expectedValue = (TestStruct?)new TestStruct5(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct?))); value = new TestStruct6(); expectedValue = (TestStruct) new TestStruct6(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct))); value = (TestStruct6?)new TestStruct6(); expectedValue = (TestStruct)(TestStruct6?)new TestStruct6(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct))); value = new TestStruct6(); expectedValue = (TestStruct?)new TestStruct6(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct?))); value = (TestStruct6?)new TestStruct6(); expectedValue = (TestStruct?)(TestStruct6?)new TestStruct6(); Assert.AreEqual(expectedValue, func(value, typeof(TestStruct?))); value = (TestStruct6?)null; Assert.AreEqual(value, func(value, typeof(TestStruct?))); value = new TestClass(); expectedValue = (int)new TestClass(); Assert.AreEqual(expectedValue, func(value, typeof(int))); value = new TestClass2(); expectedValue = (int)new TestClass2(); Assert.AreEqual(expectedValue, func(value, typeof(int))); value = new TestClass2(); expectedValue = (long)new TestClass2(); Assert.AreEqual(expectedValue, func(value, typeof(long))); value = new TestClass2(); expectedValue = (bool)new TestClass2(); Assert.AreEqual(expectedValue, func(value, typeof(bool))); value = new TestClass13(); expectedValue = (Enum) new TestClass13(); Assert.AreEqual(expectedValue, func(value, typeof(Enum))); value = new TestClass12(); expectedValue = (int?)new TestClass12(); Assert.AreEqual(expectedValue, func(value, typeof(int?))); value = new TestClass8(); expectedValue = (TestClass6) new TestClass8(); Assert.AreEqual(expectedValue, func(value, typeof(TestClass6))); value = new TestClass6(); expectedValue = (TestClass7) new TestClass6(); Assert.AreEqual(expectedValue, func(value, typeof(TestClass7))); value = 10; expectedValue = (TestClass6)10; Assert.AreEqual(expectedValue, func(value, typeof(TestClass6))); value = new TestClass(); expectedValue = (long)new TestClass(); Assert.AreEqual(expectedValue, func(value, typeof(long))); value = new TestClass(); expectedValue = (decimal) new TestClass(); Assert.AreEqual(expectedValue, func(value, typeof(decimal))); value = new TestClass2(); expectedValue = (decimal) new TestClass2(); Assert.AreEqual(expectedValue, func(value, typeof(decimal))); value = (short)10; expectedValue = (TestClass6)(short)10; Assert.AreEqual(expectedValue, func(value, typeof(TestClass6))); value = new TestClass6(); expectedValue = (long)new TestClass6(); Assert.AreEqual(expectedValue, func(value, typeof(long))); #endregion // 6.1.11 用户定义的隐式转换 }
public void Update() { var TempGuid = Guid.NewGuid(); var TestObject = new Utilities.ORM.Manager.Session(); var TempObject = new TestClass2(); TempObject.BoolReference = true; TempObject.ByteArrayReference = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; TempObject.ByteReference = 12; TempObject.CharReference = 'v'; TempObject.DecimalReference = 1.4213m; TempObject.DoubleReference = 1.32645d; TempObject.EnumReference = TestEnum.Value2; TempObject.FloatReference = 1234.5f; TempObject.GuidReference = TempGuid; TempObject.IntReference = 145145; TempObject.LongReference = 763421; TempObject.ManyToManyIEnumerable = new TestClass2[] { new TestClass2(), new TestClass2() }; TempObject.ManyToManyList = new TestAbstractClass[] { new TestClass2(), new TestClass2(), new TestClass2() }.ToList(); TempObject.ManyToOneIEnumerable = new TestClass2[] { new TestClass2(), new TestClass2(), new TestClass2() }; TempObject.ManyToOneItem = new TestClass2(); TempObject.ManyToOneList = new TestAbstractClass[] { new TestClass2(), new TestClass2(), new TestClass2() }.ToList(); TempObject.Map = new TestClass2(); TempObject.NullStringReference = null; TempObject.ShortReference = 5423; TempObject.StringReference = "agsdpghasdg"; TestObject.Save <TestAbstractClass, int>(TempObject); Assert.Equal(true, TempObject.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, TempObject.ByteArrayReference); Assert.Equal(12, TempObject.ByteReference); Assert.Equal('v', TempObject.CharReference); Assert.Equal(1.4213m, TempObject.DecimalReference); Assert.Equal(1.32645d, TempObject.DoubleReference); Assert.Equal(TestEnum.Value2, TempObject.EnumReference); Assert.Equal(1234.5f, TempObject.FloatReference); Assert.Equal(TempGuid, TempObject.GuidReference); Assert.Equal(145145, TempObject.IntReference); Assert.Equal(763421, TempObject.LongReference); Assert.Equal(2, TempObject.ManyToManyIEnumerable.Count()); Assert.Equal(3, TempObject.ManyToManyList.Count); Assert.Equal(3, TempObject.ManyToOneIEnumerable.Count()); Assert.NotNull(TempObject.ManyToOneItem); Assert.Equal(3, TempObject.ManyToOneList.Count); Assert.NotNull(TempObject.Map); Assert.Equal(null, TempObject.NullStringReference); Assert.Equal(5423, TempObject.ShortReference); Assert.Equal("agsdpghasdg", TempObject.StringReference); var Temp = new Utilities.ORM.Manager.QueryProvider.Default.DatabaseBatch(new Utilities.ORM.Manager.SourceProvider.Manager(Utilities.IoC.Manager.Bootstrapper.ResolveAll <IDatabase>()).GetSource("Data Source=localhost;Initial Catalog=SessionWithAbstractClassTestDatabase;Integrated Security=SSPI;Pooling=false")); var Items = Temp.AddCommand(null, null, CommandType.Text, "SELECT * FROM TestAbstractClass_").Execute().First(); TestAbstractClass Item = Items.FirstOrDefault(x => x.BoolReference_); ((IORMObject)Item).Session0 = new Utilities.ORM.Manager.Session(); Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Item.ByteArrayReference); Assert.Equal(12, Item.ByteReference); Assert.Equal('v', Item.CharReference); Assert.Equal(1.4213m, Item.DecimalReference); Assert.Equal(1.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value2, Item.EnumReference); Assert.Equal(1234.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(145145, Item.IntReference); Assert.Equal(763421, Item.LongReference); Assert.Equal(2, Item.ManyToManyIEnumerable.Count()); Assert.Equal(3, Item.ManyToManyList.Count); Assert.Equal(3, Item.ManyToOneIEnumerable.Count()); Assert.NotNull(Item.ManyToOneItem); Assert.Equal(3, Item.ManyToOneList.Count); Assert.NotNull(Item.Map); Assert.Equal(null, Item.NullStringReference); Assert.Equal(5423, Item.ShortReference); Assert.Equal("agsdpghasdg", Item.StringReference); Item.ByteArrayReference = new byte[] { 11, 12, 13, 14, 15, 16, 17, 18, 19, 110 }; Item.ByteReference = 121; Item.CharReference = 'V'; Item.DecimalReference = 11.4213m; Item.DoubleReference = 11.32645d; Item.EnumReference = TestEnum.Value3; Item.FloatReference = 14.5f; Item.IntReference = 1451445; Item.LongReference = 7634121; Item.ShortReference = 43; Item.StringReference = "Something"; TestObject.Save <TestAbstractClass, int>(Item); Temp = new Utilities.ORM.Manager.QueryProvider.Default.DatabaseBatch(new Utilities.ORM.Manager.SourceProvider.Manager(Utilities.IoC.Manager.Bootstrapper.ResolveAll <IDatabase>()).GetSource("Data Source=localhost;Initial Catalog=SessionWithAbstractClassTestDatabase;Integrated Security=SSPI;Pooling=false")); Items = Temp.AddCommand(null, null, CommandType.Text, "SELECT * FROM TestAbstractClass_").Execute().First(); Item = Items.FirstOrDefault(x => x.BoolReference_); ((IORMObject)Item).Session0 = new Utilities.ORM.Manager.Session(); Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 11, 12, 13, 14, 15, 16, 17, 18, 19, 110 }, Item.ByteArrayReference); Assert.Equal(121, Item.ByteReference); Assert.Equal('V', Item.CharReference); Assert.Equal(11.4213m, Item.DecimalReference); Assert.Equal(11.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value3, Item.EnumReference); Assert.Equal(14.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(1451445, Item.IntReference); Assert.Equal(7634121, Item.LongReference); Assert.Equal(2, Item.ManyToManyIEnumerable.Count()); Assert.Equal(3, Item.ManyToManyList.Count); Assert.Equal(3, Item.ManyToOneIEnumerable.Count()); Assert.NotNull(Item.ManyToOneItem); Assert.Equal(3, Item.ManyToOneList.Count); Assert.NotNull(Item.Map); Assert.Equal(null, Item.NullStringReference); Assert.Equal(43, Item.ShortReference); Assert.Equal("Something", Item.StringReference); }
static void Alloc <T>(out T value) where T : TestClass2 { value = TestClass2.Alloc() as T; }
public TestClass3(TestClass2 inner) { Inner = inner; }
public TestClass2(TestClass2 p1, string p2) { }
private static void CreateTestWorkbook() { var message = "Howdy there!"; TestClass2.CreateTestWorkbook(message); }
public void TestRegisterFunction () { using (Lua lua = new Lua ()) { lua.RegisterFunction ("func1", null, typeof(TestClass2).GetMethod ("func")); object[] vals1 = lua.GetFunction ("func1").Call (2, 3); Assert.AreEqual (5.0f, Convert.ToSingle (vals1 [0])); TestClass2 obj = new TestClass2 (); lua.RegisterFunction ("func2", obj, typeof(TestClass2).GetMethod ("funcInstance")); vals1 = lua.GetFunction ("func2").Call (2, 3); Assert.AreEqual (5.0f, Convert.ToSingle (vals1 [0])); } }
public void UpdateCascade() { Guid TempGuid = Guid.NewGuid(); var TestObject = new Utilities.ORM.Manager.Session(); var TempObject = new TestClass2(); TempObject.BoolReference = true; TempObject.ByteArrayReference = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; TempObject.ByteReference = 12; TempObject.CharReference = 'v'; TempObject.DecimalReference = 1.4213m; TempObject.DoubleReference = 1.32645d; TempObject.EnumReference = TestEnum.Value2; TempObject.FloatReference = 1234.5f; TempObject.GuidReference = TempGuid; TempObject.IntReference = 145145; TempObject.LongReference = 763421; TempObject.ManyToManyIEnumerable = new TestClass2[] { new TestClass2(), new TestClass2() }; TempObject.ManyToManyList = new ITestInterface[] { new TestClass2(), new TestClass2(), new TestClass2() }.ToList(); TempObject.ManyToOneIEnumerable = new TestClass2[] { new TestClass2(), new TestClass2(), new TestClass2() }; TempObject.ManyToOneItem = new TestClass2(); TempObject.ManyToOneList = new ITestInterface[] { new TestClass2(), new TestClass2(), new TestClass2() }.ToList(); TempObject.ManyToOneIList = new ITestInterface[] { new TestClass2(), new TestClass2(), new TestClass2() }.ToList(); TempObject.ManyToManyIList = new ITestInterface[] { new TestClass2(), new TestClass2() }.ToList(); TempObject.ManyToOneICollection = new ITestInterface[] { new TestClass2(), new TestClass2(), new TestClass2(), new TestClass2() }.ToList(); TempObject.ManyToManyICollection = new ITestInterface[] { new TestClass2() }.ToList(); TempObject.Map = new TestClass2(); TempObject.NullStringReference = null; TempObject.ShortReference = 5423; TempObject.StringReference = "agsdpghasdg"; TestObject.Save <TestClass2, int>(TempObject); Assert.Equal(true, TempObject.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, TempObject.ByteArrayReference); Assert.Equal(12, TempObject.ByteReference); Assert.Equal('v', TempObject.CharReference); Assert.Equal(1.4213m, TempObject.DecimalReference); Assert.Equal(1.32645d, TempObject.DoubleReference); Assert.Equal(TestEnum.Value2, TempObject.EnumReference); Assert.Equal(1234.5f, TempObject.FloatReference); Assert.Equal(TempGuid, TempObject.GuidReference); Assert.Equal(145145, TempObject.IntReference); Assert.Equal(763421, TempObject.LongReference); Assert.Equal(2, TempObject.ManyToManyIEnumerable.Count()); Assert.Equal(3, TempObject.ManyToManyList.Count); Assert.Equal(3, TempObject.ManyToOneIEnumerable.Count()); Assert.NotNull(TempObject.ManyToOneItem); Assert.Equal(3, TempObject.ManyToOneList.Count); Assert.Equal(3, TempObject.ManyToOneIList.Count); Assert.Equal(2, TempObject.ManyToManyIList.Count); Assert.Equal(4, TempObject.ManyToOneICollection.Count); Assert.Equal(1, TempObject.ManyToManyICollection.Count); Assert.NotNull(TempObject.Map); Assert.Equal(null, TempObject.NullStringReference); Assert.Equal(5423, TempObject.ShortReference); Assert.Equal("agsdpghasdg", TempObject.StringReference); var Temp = new Utilities.ORM.Manager.QueryProvider.Default.DatabaseBatch(new Utilities.ORM.Manager.SourceProvider.Manager(Utilities.IoC.Manager.Bootstrapper.ResolveAll <IDatabase>()).GetSource("Data Source=localhost;Initial Catalog=SessionUsingComposition;Integrated Security=SSPI;Pooling=false")); IList <dynamic> Items = Temp.AddCommand(null, null, CommandType.Text, "SELECT * FROM TestClass2_").Execute().First(); TestClass2 Item = Items.FirstOrDefault(x => x.BoolReference_); ((IORMObject)Item).Session0 = new Utilities.ORM.Manager.Session(); Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Item.ByteArrayReference); Assert.Equal(12, Item.ByteReference); Assert.Equal('v', Item.CharReference); Assert.Equal(1.4213m, Item.DecimalReference); Assert.Equal(1.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value2, Item.EnumReference); Assert.Equal(1234.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(145145, Item.IntReference); Assert.Equal(763421, Item.LongReference); Assert.Equal(2, Item.ManyToManyIEnumerable.Count()); Assert.Equal(3, Item.ManyToManyList.Count); Assert.Equal(3, Item.ManyToOneIEnumerable.Count()); Assert.NotNull(Item.ManyToOneItem); Assert.Equal(3, Item.ManyToOneList.Count); Assert.NotNull(Item.Map); Assert.Equal(null, Item.NullStringReference); Assert.Equal(5423, Item.ShortReference); Assert.Equal("agsdpghasdg", Item.StringReference); Item.Map = new TestClass2 { FloatReference = 10f }; Item.ManyToManyIEnumerable.First().FloatReference = 11f; Item.ManyToManyList.Add(new TestClass2 { FloatReference = 12f }); Item.ManyToOneIEnumerable.First().FloatReference = 13f; Item.ManyToOneItem.FloatReference = 14f; Item.ManyToOneList = new ITestInterface[] { new TestClass2(), new TestClass2() }.ToList(); Item.ManyToManyIList.Add(new TestClass2 { FloatReference = 15f }); Item.ManyToOneIList.Add(new TestClass2 { FloatReference = 16f }); Item.ManyToManyICollection.Add(new TestClass2 { FloatReference = 17f }); Item.ManyToOneICollection.Add(new TestClass2 { FloatReference = 18f }); TestObject.Save <TestClass2, int>(Item); Temp = new Utilities.ORM.Manager.QueryProvider.Default.DatabaseBatch(new Utilities.ORM.Manager.SourceProvider.Manager(Utilities.IoC.Manager.Bootstrapper.ResolveAll <IDatabase>()).GetSource("Data Source=localhost;Initial Catalog=SessionUsingComposition;Integrated Security=SSPI;Pooling=false")); Items = Temp.AddCommand(null, null, CommandType.Text, "SELECT * FROM TestClass2_").Execute().First(); Item = Items.FirstOrDefault(x => x.BoolReference_); ((IORMObject)Item).Session0 = new Utilities.ORM.Manager.Session(); Assert.Equal(10, Item.Map.FloatReference); Assert.Equal(11f, Item.ManyToManyIEnumerable.First().FloatReference); Assert.Equal(12f, Item.ManyToManyList.Last().FloatReference); Assert.Equal(13f, Item.ManyToOneIEnumerable.First().FloatReference); Assert.Equal(14f, Item.ManyToOneItem.FloatReference); Assert.Equal(15f, Item.ManyToManyIList.Last().FloatReference); Assert.Equal(16f, Item.ManyToOneIList.Last().FloatReference); Assert.Equal(17f, Item.ManyToManyICollection.Last().FloatReference); Assert.Equal(18f, Item.ManyToOneICollection.Last().FloatReference); Assert.Equal(2, Item.ManyToOneList.Count); }
public void testEnumInClass2() { var tmp = new TestClass2(MyFlagsEnum.V2); }
public void TestClass() { var c2 = new TestClass2(); Assert.AreEqual( BuildResult( "!YamlSerializerTest.YamlRepresenterTest%2BTestClass2", "Items: ", " Capacity: 0" ), YamlSerializer.Serialize(c2) ); c2.Items.Add(new TestClass1()); Assert.AreEqual( BuildResult( "!YamlSerializerTest.YamlRepresenterTest%2BTestClass2", "Items: ", " Capacity: 4", " ICollection.Items: ", " - {}" ), YamlSerializer.Serialize(c2) ); c2.Items[0].a = 1; Assert.AreEqual( BuildResult( "!YamlSerializerTest.YamlRepresenterTest%2BTestClass2", "Items: ", " Capacity: 4", " ICollection.Items: ", " - a: 1" ), YamlSerializer.Serialize(c2) ); // Identical values in different numeric types can not be compared // after being boxed. Assert.IsTrue((0.0).Equals(0)); // double.Equals(double) converts int to double before comparison Assert.IsFalse(0.0.Equals((object)0)); Assert.IsFalse(((object)0.0).Equals(0)); // !! Assert.IsFalse(((object)(float)0.0).Equals(0.0)); // !! Assert.IsFalse(((object)0.0) == ((object)0)); // !! Assert.IsFalse(ValueType.Equals((object)0.0, (object)0)); // !! Assert.IsFalse(ValueType.Equals((object)0.0, (object)(float)0)); // !! Assert.IsFalse(((ValueType)0.0) == ((ValueType)0)); // !! Assert.IsFalse(((ValueType)0.0) == ((ValueType)0)); // !! Assert.IsFalse(Math.Equals((object)0, (object)0.0)); // !!!! Assert.IsFalse(TypeDescriptor.Equals((object)0.0, (object)0)); // Assert.Throws<ArgumentException>(()=> 0.0.CompareTo( (object)0)); // Assert.Throws<InvalidCastException>(()=> ((double)(object)0).CompareTo((double)(object)(float)0.0)); Assert.IsTrue(0.0 == (double)(int)(object)0); Assert.IsTrue(0.0 == (double)(decimal)(object)(decimal)0); Assert.IsTrue(0 == (int)0.0); Assert.IsFalse(0 == (int)(double)(object)double.NaN); // !! object nan = double.NaN; object doubleNan = (double)nan; // Assert.Throws<InvalidCastException>(() => 0.CompareTo((int)doubleNan)); // !! Assert.IsFalse(double.NaN == double.NaN); Assert.IsTrue(typeof(bool).IsPrimitive); Assert.IsTrue(typeof(bool).IsValueType); Assert.IsFalse(typeof(bool).IsPointer); Assert.IsTrue(typeof(bool).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(bool).IsSerializable); Assert.IsFalse(typeof(bool).IsClass); Assert.IsTrue(typeof(char).IsPrimitive); Assert.IsTrue(typeof(char).IsValueType); Assert.IsFalse(typeof(char).IsPointer); Assert.IsTrue(typeof(char).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(char).IsSerializable); Assert.IsFalse(typeof(char).IsClass); Assert.IsTrue(typeof(int).IsPrimitive); Assert.IsTrue(typeof(int).IsValueType); Assert.IsFalse(typeof(int).IsPointer); Assert.IsTrue(typeof(int).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(int).IsSerializable); Assert.IsFalse(typeof(int).IsClass); Assert.IsTrue(typeof(double).IsPrimitive); Assert.IsTrue(typeof(double).IsValueType); Assert.IsFalse(typeof(double).IsPointer); Assert.IsTrue(typeof(double).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(double).IsSerializable); Assert.IsFalse(typeof(double).IsClass); Assert.IsFalse(typeof(void *).IsPrimitive); Assert.IsFalse(typeof(void *).IsValueType); Assert.IsTrue(typeof(void *).IsPointer); Assert.IsFalse(typeof(void *).IsSubclassOf(typeof(ValueType))); Assert.IsFalse(typeof(void *).IsSerializable); Assert.IsTrue(typeof(void *).IsClass); Assert.IsTrue(typeof(IntPtr).IsPrimitive); Assert.IsTrue(typeof(IntPtr).IsValueType); Assert.IsFalse(typeof(IntPtr).IsPointer); // ! Assert.IsTrue(typeof(IntPtr).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(IntPtr).IsSerializable); // ! Assert.IsFalse(typeof(IntPtr).IsClass); Assert.IsFalse(typeof(Test1).IsPrimitive); Assert.IsTrue(typeof(Test1).IsValueType); Assert.IsFalse(typeof(Test1).IsPointer); Assert.IsTrue(typeof(Test1).IsSubclassOf(typeof(ValueType))); Assert.IsFalse(typeof(Test1).IsSerializable); // ! Assert.IsFalse(typeof(Test1).IsClass); Assert.IsFalse(typeof(string).IsPrimitive); Assert.IsFalse(typeof(string).IsValueType); Assert.IsFalse(typeof(string).IsPointer); Assert.IsFalse(typeof(string).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(string).IsSerializable); Assert.IsTrue(typeof(string).IsClass); Assert.IsFalse(typeof(decimal).IsPrimitive); Assert.IsTrue(typeof(decimal).IsValueType); Assert.IsFalse(typeof(decimal).IsPointer); Assert.IsTrue(typeof(decimal).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(decimal).IsSerializable); Assert.IsFalse(typeof(decimal).IsClass); Assert.IsFalse(typeof(Enum).IsPrimitive); Assert.IsFalse(typeof(Enum).IsValueType); Assert.IsFalse(typeof(Enum).IsPointer); Assert.IsTrue(typeof(Enum).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(Enum).IsSerializable); //Assert.IsFalse(typeof(Enum).IsClass); TODO: THIS IS FAILING ON PCL, WTF? Assert.IsFalse(typeof(Test2).IsPrimitive); Assert.IsTrue(typeof(Test2).IsValueType); Assert.IsFalse(typeof(Test2).IsPointer); Assert.IsTrue(typeof(Test2).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(Test2).IsSerializable); Assert.IsFalse(typeof(Test2).IsClass); Assert.IsFalse(typeof(Array).IsPrimitive); Assert.IsFalse(typeof(Array).IsValueType); Assert.IsFalse(typeof(Array).IsPointer); Assert.IsFalse(typeof(Array).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(Array).IsSerializable); Assert.IsTrue(typeof(Array).IsClass); Assert.IsFalse(typeof(int[]).IsPrimitive); Assert.IsFalse(typeof(int[]).IsValueType); Assert.IsFalse(typeof(int[]).IsPointer); Assert.IsFalse(typeof(int[]).IsSubclassOf(typeof(ValueType))); Assert.IsTrue(typeof(int[]).IsSerializable); Assert.IsTrue(typeof(int[]).IsClass); Assert.IsFalse(typeof(Test3).IsPrimitive); Assert.IsFalse(typeof(Test3).IsValueType); Assert.IsFalse(typeof(Test3).IsPointer); Assert.IsFalse(typeof(Test3).IsSubclassOf(typeof(ValueType))); Assert.IsFalse(typeof(Test3).IsSerializable); Assert.IsTrue(typeof(Test3).IsClass); Assert.IsFalse(typeof(Test4).IsNotPublic); ShowTypeProperties(typeof(int)); ShowTypeProperties(typeof(IntPtr)); ShowTypeProperties(typeof(void *)); ShowTypeProperties(typeof(decimal)); ShowTypeProperties(typeof(Test1)); ShowTypeProperties(typeof(Enum)); ShowTypeProperties(typeof(Test2)); ShowTypeProperties(typeof(string)); ShowTypeProperties(typeof(Array)); ShowTypeProperties(typeof(int[])); ShowTypeProperties(typeof(string[])); ShowTypeProperties(typeof(Test3)); ShowTypeProperties(typeof(Test4)); }
public void DatabaseCanStoreComplexObject() { TestClass3 c3 = new TestClass3(); c3.Boolean = true; c3.Date = DateTime.Now; c3.Name = "SuperName"; c3.IntSixteen = 16; c3.IntThirtyTwo = 32; c3.IntSixtyFour = 64; c3.Class1 = new TestClass1(); c3.Class1.Boolean = true; c3.Class1.Date = DateTime.Now; c3.Class1.Name = "SuperName"; c3.Class1.IntSixteen = 16; c3.Class1.IntThirtyTwo = 32; c3.Class1.IntSixtyFour = 64; TestClass2 c2 = new TestClass2(); c2.Boolean = true; c2.Date = DateTime.Now; c2.Name = "SuperName"; c2.IntSixteen = 16; c2.IntThirtyTwo = 32; c2.IntSixtyFour = 64; c2.Class3 = c3; TestClass1 c1 = new TestClass1(); c1.Boolean = true; c1.Date = DateTime.Now; c1.Name = "SuperName"; c1.IntSixteen = 16; c1.IntThirtyTwo = 32; c1.IntSixtyFour = 64; c1.Class2 = c2; ObjectReference<TestClass1> reference = _database.Store(c1); Assert.IsNotNull(reference.Object); Assert.IsNotNull(reference.Id); Assert.AreEqual(c1.ToString(), reference.Object.ToString()); }
public TestClass2(TestClass2 p1, TestEnum p2, TestClass p3) { }
public TestClass2 Add(TestClass2 p) => p;
public void Target_InstanceConstructor_Doesnt_Inject_Anything_Else() { var t2 = new TestClass2(); t2.InstanceMethod(); Assert.Equal (new[] {"instance ctor"}, calls2); }
public TestClass() { InnerTestClassObject = new TestClass2(); }
public void WrongReturn() { TestClass2 orig = new TestClass2(); Assert.Throws <ReflectedCastMissingMethodsException>(() => ReflectedCaster.Default.CastToInterface <ITestInterface2>(orig)); }
public TestClass3(TestClass tc, TestClass2 tc2) { }
void PrintResults(string rawJson) { // Raw output: /*DB.Log(DC.Log("******** raw string from Twitter ********")); * DB.Log(DC.Log(rawJson)); * * * // Turn the JSON into C# objects * var search = JsonReader.Deserialize<TwitterSearchResults>(rawJson); * * * // iterate through the array of results; * DB.Log(DC.Log("******** search results ********")); * * * foreach (var tweet in search.results) { * DB.Log(DC.Log(tweet.from_user_name + " : " + tweet.text)); * } * * DB.Log(DC.Log("******** serialize an entity ********")); * * JsonWriterSettings settings = new JsonWriterSettings(); * settings.PrettyPrint = true; * * System.Text.StringBuilder output = new System.Text.StringBuilder(); * * JsonWriter writer = new JsonWriter (output,settings); * writer.Write (search.results[0]); * * // this turns a C# object into a JSON string. * string json = output.ToString();//JsonWriter.Serialize(); * * DB.Log(DC.Log(json));*/ for (int i = 0; i < 10; i++) { System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start(); System.Text.StringBuilder output = new System.Text.StringBuilder(); Debug.Log("+++ Serializing +++"); JsonWriterSettings settings = new JsonWriterSettings(); settings.PrettyPrint = false; settings.AddTypeConverter(new VectorConverter()); TestClass test = new TestClass(); test.vec.y = 128.513589999F; JsonWriter writer = new JsonWriter(output, settings); Debug.Log("+++ Writing +++"); writer.Write(test); if (i == 0) { Debug.Log(output.ToString()); } Debug.Log("+++ Deserializing - Init +++"); JsonReaderSettings settings2 = new JsonReaderSettings(); settings2.AddTypeConverter(new VectorConverter()); JsonReader reader = new JsonReader(output.ToString(), settings2); Debug.Log("+++ Deserializing +++"); Debug.Log("Output: " + output.ToString()); TestClass deserialized = reader.Deserialize <TestClass>(); watch.Stop(); Debug.Log((watch.ElapsedTicks * 0.0001).ToString("0.00")); Debug.Log(deserialized.vec.y.ToString("r")); } String dummy = "{\"type\":1,\"operation\":1,\"response\":{\"status\":2,\"numChars\":0}}"; String resp = "{\"status\":2,\"numChars\":0}"; JsonReaderSettings sett = new JsonReaderSettings(); JsonReader reader2 = new JsonReader(dummy, sett); TestClass2 obj = reader2.Deserialize <TestClass2>(); }
public void Any() { Guid TempGuid = Guid.NewGuid(); var TestObject = new Utilities.ORM.Manager.Session(); for (int x = 0; x < 100; ++x) { var TempObject = new TestClass2(); TempObject.BoolReference = true; TempObject.ByteArrayReference = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; TempObject.ByteReference = 12; TempObject.CharReference = 'v'; TempObject.DecimalReference = 1.4213m; TempObject.DoubleReference = 1.32645d; TempObject.EnumReference = TestEnum.Value2; TempObject.FloatReference = 1234.5f; TempObject.GuidReference = TempGuid; TempObject.IntReference = 145145; TempObject.LongReference = 763421; TempObject.NullStringReference = null; TempObject.ShortReference = 5423; TempObject.StringReference = "agsdpghasdg"; TestObject.Save <TestClass2, int>(TempObject); } TestClass2 Item = TestObject.Any <TestClass2>(); Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Item.ByteArrayReference); Assert.Equal(12, Item.ByteReference); Assert.Equal('v', Item.CharReference); Assert.Equal(1.4213m, Item.DecimalReference); Assert.Equal(1.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value2, Item.EnumReference); Assert.Equal(1234.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(145145, Item.IntReference); Assert.Equal(763421, Item.LongReference); Assert.Equal(null, Item.NullStringReference); Assert.Equal(5423, Item.ShortReference); Assert.Equal("agsdpghasdg", Item.StringReference); Item = TestObject.Any <TestClass2>(new Utilities.ORM.Parameters.EqualParameter <int>(1000, "ID_")); Assert.Null(Item); Item = TestObject.Any <TestClass2>(new Utilities.ORM.Parameters.EqualParameter <int>(10, "ID_")); Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Item.ByteArrayReference); Assert.Equal(12, Item.ByteReference); Assert.Equal('v', Item.CharReference); Assert.Equal(1.4213m, Item.DecimalReference); Assert.Equal(1.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value2, Item.EnumReference); Assert.Equal(1234.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(145145, Item.IntReference); Assert.Equal(763421, Item.LongReference); Assert.Equal(null, Item.NullStringReference); Assert.Equal(5423, Item.ShortReference); Assert.Equal("agsdpghasdg", Item.StringReference); Assert.Equal(10, Item.ID); Item = TestObject.Any <TestClass2>(new Utilities.ORM.Parameters.EqualParameter <int>(20, "ID_")); Assert.Equal(true, Item.BoolReference); Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Item.ByteArrayReference); Assert.Equal(12, Item.ByteReference); Assert.Equal('v', Item.CharReference); Assert.Equal(1.4213m, Item.DecimalReference); Assert.Equal(1.32645d, Item.DoubleReference); Assert.Equal(TestEnum.Value2, Item.EnumReference); Assert.Equal(1234.5f, Item.FloatReference); Assert.Equal(TempGuid, Item.GuidReference); Assert.Equal(145145, Item.IntReference); Assert.Equal(763421, Item.LongReference); Assert.Equal(null, Item.NullStringReference); Assert.Equal(5423, Item.ShortReference); Assert.Equal("agsdpghasdg", Item.StringReference); Assert.Equal(20, Item.ID); }
public void TestMemberNoEvent () { TestClass2 test = new TestClass2(); BindingContext bc = new BindingContext (); BindingManagerBase bm = bc[test]; Assert.IsTrue (typeof (PropertyManager).IsAssignableFrom (bm.GetType()), "A1"); bm.CurrentChanged += new EventHandler (OnCurrentChanged); currentChangedRaised = positionChangedRaised = false; test.Property = 5; Assert.IsFalse (currentChangedRaised, "A2"); Assert.IsFalse (positionChangedRaised, "A3"); }
public TestClass() { NonNullableStringProp = string.Empty; NonNullableRefProp = new TestClass2(); }
static void Main(string[] args) { String localPath = Environment.CurrentDirectory; FileDB db = FileDB.createDatabase(localPath + @"\db", "testDB2"); Console.WriteLine(db); TestClass2 rectangle = new TestClass2(db); rectangle.Length = 2; rectangle.height = 3; rectangle.save(); Console.WriteLine(db); db.save(); Console.ReadKey(); TestClass2 loadRect = TestClass2.loadByID(0); Console.WriteLine("Length: {0} , Height: {1}", loadRect.Length, loadRect.height); /*TestClass tc = new TestClass(db, "1.23") { Name = "Curt" }; tc.save(); Console.WriteLine(db); db.save(); Console.ReadKey(); tc.Name = "Michael"; tc.save(); Console.WriteLine("ID is {0}", tc.getID()); db.save(); TestClass tc2 = TestClass.loadByID(0); Console.WriteLine("Name of tc2: {0}", tc2.Name);*/ /*FileDB db = FileDB.createDatabase(localPath + @"\db", "testDB"); Console.WriteLine(db); Console.WriteLine(db.getTableByName("testTable3"));*/ /*FileDBTable table1 = db.createTable("testTable1"); table1.addColumn("name", typeof(String)); table1.addColumn("surname", typeof(String)); table1.addColumn("Student", typeof(String)); table1.addRow("Phillip", "Phoelich", "Yes"); table1.addRow("Morten", "Therkildsen", "Yes"); FileDBTable table2 = db.createTable("testTable2"); table2.addColumn("name", typeof(String)); table2.addColumn("study", typeof(String)); table2.addRow("Phillip", "SWU"); table2.addRow("Morten", "SWU"); Console.WriteLine(db); Console.WriteLine(); Console.WriteLine(table1); Console.WriteLine(); Console.WriteLine(table2); db.save(); Console.ReadKey(); db.deleteTable(ref table1); Console.WriteLine(db); db.save();*/ Console.ReadKey(); }
public TestClass2(TestClass2 p1, TestEnum p2) { }