Пример #1
0
        public static void TestInitialize(TestContext c)
        {
            String master_ip   = GetIp();
            String master_port = "8080";
            String server_port = "808";

            TcpChannel channel = new TcpChannel();

            ChannelServices.RegisterChannel(channel, false);
            master = Process.Start(@"..\..\..\Master\bin\Debug\Master.exe");
            Thread.Sleep(1000);
            for (int i = 1; i < 5; i++)
            {
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.FileName  = @"..\..\..\Server\bin\Debug\Server.exe";
                startInfo.Arguments = String.Format("{0} {1} {2}", master_ip, master_port, server_port + i);
                server = Process.Start(startInfo);
                Thread.Sleep(1000);
            }

            proxy1 = new InstanceProxy();
            proxy2 = new InstanceProxy();
            proxy1.Init();
            proxy2.Init();
        }
Пример #2
0
 /// <summary>语言包加载完成</summary>
 private void OnComplete_LoadedLang()
 {
     TextManager.SetQueryString();
     ItemManager.Init();
     CommonConfig.Init();
     LotterRewardManager.Init();
     SuitConfig.Init();
     ClothesConfig.Init();
     ClothesSlevelConfig.Init();
     ClothesLevelConfig.Init();
     BabyLikingConfig.Init();
     UseEquipConfig.Init();
     ClothesInheritConfig.Init();
     ClothesMapConfig.Init();
     CloneLevelConfig.Init();
     LevelRewardConfig.Init();
     ArenaConfig.Init();
     SkillLevelConfig.Init();
     PropertySkillLevelConfig.Init();
     BossDailyConfig.Init();
     BossRewardConfig.Init();
     InstanceProxy.Get <PieceSwitchConfig>().LoadXml();
     InstanceProxy.Get <PlayerPositionConfig>().LoadXml();
     InstanceProxy.Get <MatchArrayConfig>().LoadXml();
     InstanceProxy.Get <PositionAttributeConfig>().LoadXml();
     InstanceProxy.Get <RandNameConfig>().LoadXml();
     InstanceProxy.Get <SkinConfig>().LoadXml();
     InstanceProxy.Get <MonsterConfig>().LoadXml();
     InstanceProxy.Get <CloneConfig>().LoadXml();
     InstanceProxy.Get <CameraConfig>().LoadXml();
     InstanceProxy.Get <MentalityMaxConfig>().LoadXml();
     InstanceProxy.Get <AbilityConfig>().LoadXml();
     InstanceProxy.Get <SkillConfig>().LoadXml();
     InstanceProxy.Get <SkillAIConfig>().LoadXml();
 }
Пример #3
0
        public void AbortedRetryTest()
        {
            this.iteration = 0;
            Aspect retryAspect = new RetryCountAspect(3, 100);

            // A thread simulating asynchronous application exit.
            Task asyncAbortGenerator = Task.Factory.StartNew(() =>
            {
                Thread.Sleep(100);
                Threading.ApplicationExiting.Set();
            });

            InstanceProxy <RetryAspectsTest> proxy = this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect));

            try
            {
                proxy.Invoke(test => test.SimulateFailureNTimes(3, true));
            }
            finally
            {
                Threading.ApplicationExiting.Reset();

                bool aborted = proxy.callLog.Exists(l => l.Key == "Retry Aborted");
                Assert.IsTrue(aborted);

                asyncAbortGenerator.Wait();
            }
        }
Пример #4
0
    /// <summary>设置皮肤</summary>
    public void SetSkin(int cfgId, Transform target)
    {
        TD_TeamSkin item = InstanceProxy.Get <SkinConfig>().GetItem(cfgId);

        SetSkin(target, item.skin, E_SkinPart.Skin);
        SetSkin(target, item.hair, E_SkinPart.Hair);
        SetSkin(target, item.cloth, E_SkinPart.Cloth);
    }
Пример #5
0
		/// <summary>
		/// Verifies that two <see cref="Konves.Testing.InstanceProxy">InstanceProxies</see> are equal by comparing the specified public and non-public properties. The assertion fails if the objects are not equal.
		/// </summary>
		/// <param name="expected">The first object to compare.  This is the obejct the unit test expects and is proxied by an <see cref="Konves.Testing.InstanceProxy">InstanceProxy</see>.</param>
		/// <param name="actual">The second object to compare. This is the object the unit test produced and is proxied by an <see cref="Konves.Testing.InstanceProxy">InstanceProxy</see>.</param>
		/// <param name="properties">The properties to compare.  If the array is <c>null</c> or does not contain any elements, all public and non-public properties are compared.</param>
		/// <exception cref="Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException"><paramref name="expected"/> is not equal to <paramref name="actual"/>.</exception>
		public static void AreEqual(InstanceProxy expected, InstanceProxy actual, params string[] properties)
		{
			if (properties == null || properties.Length == 0)
				properties = actual.Type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Select(p => p.Name).ToArray();

			foreach (string name in properties)
			{
				object a = expected.GetValue(name, null);
				object b = actual.GetValue(name, null);

				if (!NullSafeEquals(a, b))
					throw new AssertFailedException(string.Format("ProxyAssert.AreEqual failed at property '{0}'. Expected:<{1}>. Actual:<{2}>.", name, a, b));
			}
		}
Пример #6
0
    /// <summary>语言包加载完成</summary>
    private void OnComplete_LoadedLang()
    {
        if (null != InitTextManagerComplete)
        {
            InitTextManagerComplete();
            InitTextManagerComplete = null;
        }

        TextManager.SetQueryString();

        InstanceProxy.Get <EffConfig>().LoadXml();
        InstanceProxy.Get <CardConfig>().LoadXml();
        InstanceProxy.Get <HeroConfig>().LoadXml();
        InstanceProxy.Get <SkillConfig>().LoadXml();
        InstanceProxy.Get <SkillPrefabInfoConfig>().LoadXml();
    }
Пример #7
0
        public void AssemblyProxyTest()
        {
            AssemblyProxy assemblyProxy = new AssemblyProxy("UnitTest", path);

            InstanceProxy instanceProxy = new InstanceProxy(assemblyProxy, assemblyProxy.SupportType.FirstOrDefault());


            var intInvoker = instanceProxy.GetMethodInvoker <TESTINVOKER>("GetInt");
            int i          = intInvoker.Invoke <int>();

            var    methodinvoker = instanceProxy.GetMethodInvoker <TESTINVOKER>("GetString");
            string s             = methodinvoker.Invoke <string>("ABCDEFG");



            instanceProxy.Dispose();
        }
Пример #8
0
    /// <summary>设置皮肤  isMain是否是主场</summary>
    public void SetGKSkin(bool isMain, Transform target)
    {
        TD_GKSkin cfg = InstanceProxy.Get <SkinConfig>().GKSkin;

        if (isMain)
        {
            SetSkin(target, cfg.skin, E_SkinPart.Skin);
            SetSkin(target, cfg.hair, E_SkinPart.Hair);
            SetSkin(target, cfg.cloth, E_SkinPart.Cloth);
        }
        else
        {
            SetSkin(target, cfg.skin2, E_SkinPart.Skin);
            SetSkin(target, cfg.hair2, E_SkinPart.Hair);
            SetSkin(target, cfg.cloth2, E_SkinPart.Cloth);
        }
    }
Пример #9
0
        public void UnloadTest()
        {
            Thread.Sleep(1500);
            int           count1        = AppDomain.CurrentDomain.GetAssemblies().Count();
            AssemblyProxy assemblyProxy = new AssemblyProxy("UnitTest", path);
            int           count2        = AppDomain.CurrentDomain.GetAssemblies().Count();

            Assert.IsTrue(count1 == count2);


            Thread.Sleep(1500);

            InstanceProxy instanceProxy = new InstanceProxy(assemblyProxy, assemblyProxy.SupportType.FirstOrDefault());

            count2 = AppDomain.CurrentDomain.GetAssemblies().Count();

            Assert.IsTrue(count1 == count2);
        }
Пример #10
0
		/// <summary>
		/// Verifies that an object proxied by an <see cref="Konves.Testing.InstanceProxy">InstanceProxy</see> is not equal to another object by comparing all public and non-public properties. The assertion fails if the objects are equal.
		/// </summary>
		/// <param name="notExpected">The first object to compare.  This is the obejct the unit test expects not to match <paramref name="actual"/> and is proxied by an <see cref="Konves.Testing.InstanceProxy">InstanceProxy</see>.</param>
		/// <param name="actual">The second object to compare. This is the object the unit test produced.</param>
		/// <exception cref="Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException"><paramref name="notExpected"/> is equal to <paramref name="actual"/>.</exception>
		public static void AreNotEqual(InstanceProxy notExpected, object actual)
		{
			AreNotEqual(notExpected, actual, null);
		}
Пример #11
0
		/// <summary>
		/// Verifies that two <see cref="Konves.Testing.InstanceProxy">InstanceProxies</see> are equal by comparing all public and non-public properties. The assertion fails if the objects are not equal.
		/// </summary>
		/// <param name="expected">The first object to compare.  This is the obejct the unit test expects and is proxied by an <see cref="Konves.Testing.InstanceProxy">InstanceProxy</see>.</param>
		/// <param name="actual">The second object to compare. This is the object the unit test produced and is proxied by an <see cref="Konves.Testing.InstanceProxy">InstanceProxy</see>.</param>
		/// <exception cref="Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException"><paramref name="expected"/> is not equal to <paramref name="actual"/>.</exception>
		public static void AreEqual(InstanceProxy expected, InstanceProxy actual)
		{
			AreEqual(expected, actual, null);
		}
		public void GetSerializationInfo()
		{
			// Arrange
			TypeProxy serializationInfo = TypeProxy.For("Konves.Nbt", "Konves.Nbt.Serialization.SerializationInfo");
			Type type = typeof(TestClass);

			InstanceProxy[] expected = new InstanceProxy[]
			{
				InstanceProxy.For(serializationInfo, NbtTagType.String, "stringProperty", null, null, null),
				InstanceProxy.For(serializationInfo, NbtTagType.Int, "IntProperty", null, null, null),
				InstanceProxy.For(serializationInfo, NbtTagType.List, "ListProperty", null, null, NbtTagType.Float)
			};

			// Act
			object actual = serializationInfo.Invoke("GetSerializationInfo", type);

			// Assert
			CollectionAssert.AreEqual(expected, (object[])actual, new InstanceProxyComparer("TagName", "TagType", "ElementType"));
		}