/// <summary>
 /// Test setup
 /// </summary>
 public ConsentTests()
 {
     CountlyImpl.SetPCLStorageIfNeeded();
     Countly.Halt();
     TestHelper.CleanDataFiles();
     Countly.Instance.deferUpload = false;
 }
Exemple #2
0
        public async void BasicDeserialization_18_1()
        {
            String targetPath = await Storage.Instance.GetFolderPath(Storage.Instance.folder) + "\\";

            String sourceFolder = TestHelper.testDataLocation + "\\SampleDataFiles\\18_1\\";

            File.Copy(sourceFolder + "sessions.xml", targetPath + "sessions.xml");
            File.Copy(sourceFolder + "userdetails.xml", targetPath + "userdetails.xml");
            File.Copy(sourceFolder + "events.xml", targetPath + "events.xml");
            File.Copy(sourceFolder + "exceptions.xml", targetPath + "exceptions.xml");
            File.Copy(sourceFolder + "devicePCL.xml", targetPath + "device.xml");

            Countly.Instance.deferUpload = true;
            await CountlyImpl.StartLegacyCountlySession(ServerInfo.serverURL, ServerInfo.appKey, ServerInfo.appVersion);

            Assert.Equal(50, Countly.Instance.Events.Count);
            Assert.Equal(50, Countly.Instance.Exceptions.Count);
            Assert.Equal(3, Countly.Instance.Sessions.Count);
            Assert.Empty(Countly.Instance.StoredRequests);
            Assert.Equal("B249FB85668941FAA8301E2A5CA95901", await Countly.GetDeviceId());

            CountlyUserDetails cud = Countly.UserDetails;

            Assert.Equal(56, cud.BirthYear);
            Assert.Equal("f", cud.Email);
            Assert.Equal("t", cud.Gender);
            Assert.Equal("g", cud.Name);
            Assert.Equal("s", cud.Organization);
            Assert.Equal("p", cud.Phone);
            Assert.Equal("1t", cud.Picture);
            Assert.Equal("u", cud.Username);
        }
 /// <summary>
 /// Test setup
 /// </summary>
 public LegacyInitTests()
 {
     CountlyImpl.SetPCLStorageIfNeeded();
     Countly.Halt();
     TestHelper.CleanDataFiles();
     CountlyImpl.StartLegacyCountlySession(ServerInfo.serverURL, ServerInfo.appKey, ServerInfo.appVersion).Wait();
 }
Exemple #4
0
        public async void LegacyInitSimpleFail()
        {
            Exception exToCatch = null;

            try
            {
                await CountlyImpl.StartLegacyCountlySession(null, "234", "345");
            }
            catch (Exception ex) { exToCatch = ex; }

            Assert.NotNull(exToCatch);
            exToCatch = null;
            Countly.Halt();

            try
            {
                await CountlyImpl.StartLegacyCountlySession("123", null, "345");
            }
            catch (Exception ex) { exToCatch = ex; }

            Assert.NotNull(exToCatch);
            exToCatch = null;
            Countly.Halt();

            try
            {
                await CountlyImpl.StartLegacyCountlySession(null, null, null);
            }
            catch (Exception ex) { exToCatch = ex; }

            Assert.NotNull(exToCatch);
            exToCatch = null;
        }
        /// <summary>
        /// Used for testing legacy session control
        /// </summary>
        public CountlyTestCases()
        {
            CountlyImpl.SetPCLStorageIfNeeded();
            Countly.Halt();
            TestHelper.CleanDataFiles();
            CountlyConfig cc = TestHelper.CreateConfig();

            Countly.Instance.Init(cc).Wait();
            Countly.Instance.SessionBegin().Wait();
        }
        public static async void CleanDataFiles()
        {
            CountlyImpl.SetPCLStorageIfNeeded();

            Storage.Instance.DeleteFile(Countly.eventsFilename).Wait();
            Storage.Instance.DeleteFile(Countly.exceptionsFilename).Wait();
            Storage.Instance.DeleteFile(Countly.sessionsFilename).Wait();
            Storage.Instance.DeleteFile(Countly.unhandledExceptionFilename).Wait();
            Storage.Instance.DeleteFile(Countly.userDetailsFilename).Wait();
            Storage.Instance.DeleteFile(Countly.storedRequestsFilename).Wait();
            Storage.Instance.DeleteFile(Device.deviceFilename).Wait();
        }
        /// <summary>
        /// Test setup
        /// </summary>
        public ThreadingTestCases()
        {
            threadSync = new ManualResetEvent(false);
            CountlyImpl.SetPCLStorageIfNeeded();
            Countly.Halt();
            TestHelper.CleanDataFiles();
            //Countly.Instance.deferUpload = true;

            CountlyConfig cc = TestHelper.CreateConfig();

            Countly.Instance.Init(cc).Wait();
            Countly.Instance.SessionBegin().Wait();
        }
 public static CountlyConfig CreateConfig()
 {
     return(CountlyImpl.CreateCountlyConfig());
 }
Exemple #9
0
 /// <summary>
 /// Test setup
 /// </summary>
 public DataStructureSerializationTests()
 {
     CountlyImpl.SetPCLStorageIfNeeded();
     Countly.Halt();
     TestHelper.CleanDataFiles();
 }
Exemple #10
0
        public async void LegacyInitSimple()
        {
            await CountlyImpl.StartLegacyCountlySession("123", "234", "345");

            await Countly.EndSession();
        }