Exemple #1
0
        public async Task TestInitialization()
        {
            var flagship = FlagshipBuilder.Start(env_id, api_key);
            var visitor  = flagship.NewVisitor("123", new Dictionary <string, object>()
            {
                { "CookieTest", true }
            });

            await visitor.SynchronizeModifications().ConfigureAwait(true);

            var test = visitor.GetModification <bool>("not_exist");

            Assert.IsFalse(test);
        }
Exemple #2
0
        public async Task TestSendHit()
        {
            var flagship = FlagshipBuilder.Start(
                env_id,
                api_key,
                new FlagshipOptions.Builder()
                .WithDecisionMode(Mode.Bucketing)
                .WithErrorHandler(new DefaultExceptionHandler(new DefaultLogger(), true))
                .Build());

            try
            {
                await flagship.SendHit("vis_id", HitType.TRANSACTION, new Event()
                {
                    Action = "action"
                });

                Assert.Fail();
            }
            catch (ArgumentException e)
            {
                Assert.AreEqual("Hit is malformed", e.Message);
            }

            try
            {
                await flagship.SendHit("vis_id", HitType.EVENT, new Event()
                {
                    Action = "action"
                });

                await flagship.SendHit("vis_id", new Event()
                {
                    Action = "action"
                });
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
Exemple #3
0
        public async Task TestBucketing()
        {
            var flagship = FlagshipBuilder.Start(
                env_id,
                api_key,
                new FlagshipOptions.Builder()
                .WithDecisionMode(Mode.Bucketing)
                .Build());

            Thread.Sleep(2000);

            var visitor = flagship.NewVisitor("123", new Dictionary <string, object>()
            {
                { "isBetaTester", "yes_it_is" }
            });

            await visitor.SynchronizeModifications().ConfigureAwait(true);

            var test = visitor.GetModification <bool>("drone");

            Assert.IsFalse(test);
        }