/// <summary>
 ///
 /// </summary>
 /// <param name="app_id"></param>
 /// <param name="secret_key"></param>
 /// <param name="env"></param>
 /// <param name="client"></param>
 public V3([NotNull] string app_id, [NotNull] string secret_key, iOSEnvironmentV3 env,
           HttpClient client)
 {
     APPID          = app_id;
     iOSEnvironment = env;
     SECRETKEY      = secret_key;
     this.client    = client;
 }
Exemplo n.º 2
0
        public void TestMethod1()
        {
            XingePushClient.InitHttpClientCompatDefaultMagic();

            AudienceType type = new PushRequest <MessageiOS> .Token();

            var m = new Model
            {
                AudienceType = type,
                TimeInterval = new TimeInterval
                {
                    StartHour = 1,
                    StartMin  = 2,
                    EndHour   = 3,
                    EndMin    = 4,
                },
                Operator1         = Operator.AND,
                Operator2         = Operator.OR,
                True              = 1,
                False             = 0,
                Null              = null,
                NullableFalse     = 0U,
                NullableTrue      = 1U,
                ThreeDays         = TimeSpan.FromDays(3),
                UInt32S           = 60U,
                Int32S            = 120,
                NullableSeconds   = null,
                NullableThreeDays = TimeSpan.FromDays(3),
                NullableUInt32S   = 60U,
                NullableInt32S    = 120,
                TagTokenPair      = new TagTokenPair
                {
                    Tag   = "abc",
                    Token = "qwert"
                },
                TagTokenPairCompat = new Compat.TagTokenPair
                {
                    tag   = "abc1",
                    token = "qwert1"
                },
                Now1            = DateTime.Now,
                Now2            = DateTimeOffset.Now,
                TimeEmpty1      = null,
                TimeEmpty2      = null,
                TimeNull2       = string.Empty,
                D1              = Internal.Constants.DefaultMessageSendTime,
                D2              = Internal.Constants.DefaultMessageSendTime,
                iOSEnv1         = 1,
                iOSEnv2         = 2,
                iOSEnvNullable  = null,
                iOSEnv1Nullable = 1,
                iOSEnv2Nullable = 2,
            };

            m.iOSEnv1_V3         = m.iOSEnv1;
            m.iOSEnv2_V3         = m.iOSEnv2;
            m.iOSEnvNullable_V3  = m.iOSEnvNullable;
            m.iOSEnv1Nullable_V3 = m.iOSEnv1Nullable;
            m.iOSEnv2Nullable_V3 = m.iOSEnv2Nullable;

            var envE = m.iOSEnv1_V3 == m.iOSEnv1 &&
                       m.iOSEnv2_V3 == m.iOSEnv2 &&
                       m.iOSEnvNullable_V3 == m.iOSEnvNullable &&
                       m.iOSEnv1Nullable_V3 == m.iOSEnv1Nullable &&
                       m.iOSEnv2Nullable_V3 == m.iOSEnv2Nullable;

            Assert.IsTrue(envE, nameof(envE));

            var json  = m.Serialize();
            var obj   = json.Deserialize <Model>();
            var json2 = obj.Serialize();

            var isOK = json == json2;

            Assert.IsTrue(isOK, nameof(isOK));

            var iOSEnv = new iOSEnvironment(1);

            Assert.IsTrue(iOSEnv == iOSEnvironment.Production, nameof(iOSEnv));

            iOSEnvironmentV3 iOSEnv3 = iOSEnv;

            Assert.IsTrue(iOSEnv3 == iOSEnvironmentV3.Production, nameof(iOSEnv3));

            Console.WriteLine(json2);

            Console.WriteLine("Size of C# bool is: {0}", sizeof(bool));
            Console.WriteLine("Size of C# char is: {0}", sizeof(char));
            Console.WriteLine("Size of C# short is: {0}", sizeof(short));
            Console.WriteLine("Size of C# int is: {0}", sizeof(int));
            Console.WriteLine("Size of C# long is: {0}", sizeof(long));
            Console.WriteLine("Size of Operator: {0}", Marshal.SizeOf(typeof(Operator)));
            Console.WriteLine("Size of DigitBoolean: {0}", Marshal.SizeOf(typeof(DigitBoolean)));
            Console.WriteLine("Size of Seconds: {0}", Marshal.SizeOf(typeof(Second)));
            Console.WriteLine("Size of NullableDateTime: {0}", Marshal.SizeOf(typeof(NullableDateTime)));
            Console.WriteLine("Size of iOSEnvironment: {0}", Marshal.SizeOf(typeof(iOSEnvironment)));
            Console.WriteLine("Size of iOSEnvironmentV3: {0}", Marshal.SizeOf(typeof(iOSEnvironmentV3)));
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="app_id"></param>
 /// <param name="secret_key"></param>
 /// <param name="env"></param>
 public V3([NotNull] string app_id, [NotNull] string secret_key, iOSEnvironmentV3 env)
     : this(app_id, secret_key, env, new HttpClient())
 {
 }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(iOSEnvironmentV3 other)
 {
     return(iOSEnvironmentV3.Equals(this, other));
 }