public void Serialize()
        {
            var stream = instance.Serialize(subscription);
            var result = instance.Deserialize <DataInstance>(stream);

            Assert.AreEqual("Test", result.Text);
        }
        public async Task Serialize()
        {
            var stream = await instance.Serialize(subscription);

            var result = await instance.Deserialize <DataInstance>(stream);

            Assert.AreEqual("Test", result.Text);
        }
Ejemplo n.º 3
0
        public void SerializeUserTime_not_specified()
        {
            var events = new List <AppMetrAction> {
                new Event("test")
            };
            var batch = new Batch(Guid.NewGuid().ToString(), 1, events);

            var defaultSerializer = new BasicJsonSerializer();

            var json = defaultSerializer.Serialize(batch);

            _output.WriteLine("Json: " + json);
        }
Ejemplo n.º 4
0
        public void SerializePayment()
        {
            var events = new List <AppMetrAction>
            {
                new Payment("order1", "trans1", "proc1", "USD", "123", isSandbox: true)
            };
            var batch = new Batch(Guid.NewGuid().ToString(), 1, events);

            var defaultSerializer = new BasicJsonSerializer();

            var json = defaultSerializer.Serialize(batch);

            _output.WriteLine("Json: " + json);
        }
Ejemplo n.º 5
0
        public void SerializeUserTime()
        {
            var e = new Event("test");

            e.SetTimestamp(1);
            Assert.Equal(1, e.GetTimestamp());

            var events = new List <AppMetrAction> {
                e
            };
            var batch = new Batch(Guid.NewGuid().ToString(), 1, events);

            var defaultSerializer = new BasicJsonSerializer();

            var json = defaultSerializer.Serialize(batch);

            _output.WriteLine("Json: " + json);
        }
Ejemplo n.º 6
0
        public void SerializeAttachEntityAttributes()
        {
            var defaultSerializer = new BasicJsonSerializer();
            var attach            = new AttachEntityAttributes("$serverUserId", "testId");
            var events            = new List <AppMetrAction> {
                attach
            };
            var batch        = new Batch(Guid.NewGuid().ToString(), 1, events);
            var json         = defaultSerializer.Serialize(batch);
            var receiveBatch = defaultSerializer.Deserialize <Batch>(json);

            _output.WriteLine("Json: " + json);

            Assert.Equal(1, receiveBatch.GetBatch().Count);
            var receivedAction = (AttachEntityAttributes)receiveBatch.GetBatch()[0];

            Assert.Equal("$serverUserId", receivedAction.GetEntityName());
            Assert.Equal("testId", receivedAction.GetEntityValue());
        }
Ejemplo n.º 7
0
        public void SerializeServerInstall()
        {
            var defaultSerializer = new BasicJsonSerializer();
            var install           = Events.ServerInstall("test").SetProperties(new Dictionary <string, object>
            {
                { "key", "value" }
            });
            var events = new List <AppMetrAction> {
                install
            };
            var batch        = new Batch(Guid.NewGuid().ToString(), 1, events);
            var json         = defaultSerializer.Serialize(batch);
            var receiveBatch = defaultSerializer.Deserialize <Batch>(json);

            Assert.Equal(1, receiveBatch.GetBatch().Count);
            var receivedAction = receiveBatch.GetBatch()[0];

            Assert.Equal("test", receivedAction.GetUserId());
            Assert.Equal(1, receivedAction.GetProperties().Count);
            Assert.Equal("value", receivedAction.GetProperties()["key"]);
        }