public static BeginSession CreateBeginSession(int indexData, int indexMetrics, long?timestamp = null) { Metrics m = CreateMetrics(indexMetrics); BeginSession bs = new BeginSession(v[indexData + 0], v[indexData + 1], v[indexData + 2], m, timestamp); return(bs); }
public void ComparingEntitiesSession() { for (int i = 0; i < 3; i++) { long ts = TimeHelper.UnixTimeNow(); BeginSession bs0 = TestHelper.CreateBeginSession(i, i, ts); BeginSession bs1 = TestHelper.CreateBeginSession(i, i, ts); BeginSession bs2 = TestHelper.CreateBeginSession(i + 1, i, ts); BeginSession bs3 = TestHelper.CreateBeginSession(i, i + 1, ts); Assert.Equal(bs0, bs1); Assert.NotEqual(bs1, bs2); Assert.NotEqual(bs1, bs3); EndSession es0 = TestHelper.CreateEndSession(i, ts); EndSession es1 = TestHelper.CreateEndSession(i, ts); EndSession es2 = TestHelper.CreateEndSession(i + 1, ts); Assert.Equal(es0, es1); Assert.NotEqual(es1, es2); UpdateSession us0 = TestHelper.CreateUpdateSession(i, i, ts); UpdateSession us1 = TestHelper.CreateUpdateSession(i, i, ts); UpdateSession us2 = TestHelper.CreateUpdateSession(i + 1, i, ts); Assert.Equal(us0, us1); Assert.NotEqual(us1, us2); } }
public void ComparingEntitiesSessionNull() { long ts = TimeHelper.UnixTimeNow(); BeginSession bs0 = TestHelper.CreateBeginSession(0, 0, ts); BeginSession bs1 = TestHelper.CreateBeginSession(0, 0, ts); bs1.Content = bs0.Content; Assert.Equal(bs0, bs1); bs0.Content = null; bs1.Content = null; Assert.Equal(bs0, bs1); bs0 = TestHelper.CreateBeginSession(0, 0, ts); bs1 = TestHelper.CreateBeginSession(0, 0, ts); bs1.Content = null; Assert.NotEqual(bs0, bs1); Assert.NotEqual(bs1, bs0); EndSession es1 = TestHelper.CreateEndSession(0, ts); EndSession es2 = TestHelper.CreateEndSession(0, ts); Assert.Equal(es1, es2); es1.Content = null; es2.Content = null; Assert.Equal(es1, es2); es1 = TestHelper.CreateEndSession(0, ts); es2 = TestHelper.CreateEndSession(0, ts); es1.Content = null; Assert.NotEqual(es1, es2); Assert.NotEqual(es2, es1); UpdateSession us1 = TestHelper.CreateUpdateSession(0, 0, ts); UpdateSession us2 = TestHelper.CreateUpdateSession(0, 0, ts); Assert.Equal(us1, us2); us1.Content = null; us2.Content = null; Assert.Equal(us1, us2); us1 = TestHelper.CreateUpdateSession(0, 0); us2 = TestHelper.CreateUpdateSession(0, 0); us2.Content = null; Assert.NotEqual(us1, us2); Assert.NotEqual(us2, us1); }
public void SerializingEntitiesSession() { BeginSession bs = TestHelper.CreateBeginSession(0, 0); String s1 = JsonConvert.SerializeObject(bs); BeginSession bs2 = JsonConvert.DeserializeObject <BeginSession>(s1); Assert.Equal(bs.Content, bs2.Content); EndSession es = TestHelper.CreateEndSession(0); String s2 = JsonConvert.SerializeObject(es); EndSession es2 = JsonConvert.DeserializeObject <EndSession>(s2); Assert.Equal(es.Content, es2.Content); UpdateSession us = TestHelper.CreateUpdateSession(0, 0); String s3 = JsonConvert.SerializeObject(us); UpdateSession us2 = JsonConvert.DeserializeObject <UpdateSession>(s3); Assert.Equal(us.Content, us2.Content); }