Beispiel #1
0
        public async Task UserExposedTest()
        {
            var notReadyStategy = new NotReadyStrategy(visitorDelegate);
            await notReadyStategy.UserExposed("key", "defaultValue", null).ConfigureAwait(false);

            fsLogManagerMock.Verify(x => x.Error(string.Format(Constants.METHOD_DEACTIVATED_ERROR, "UserExposed", FlagshipStatus.NOT_INITIALIZED), "UserExposed"), Times.Once());
        }
Beispiel #2
0
        public async Task SendHitTest()
        {
            var notReadyStategy = new NotReadyStrategy(visitorDelegate);
            await notReadyStategy.SendHit(new Hit.Screen("Home")).ConfigureAwait(false);

            fsLogManagerMock.Verify(x => x.Error(string.Format(Constants.METHOD_DEACTIVATED_ERROR, "SendHit", FlagshipStatus.NOT_INITIALIZED), "SendHit"), Times.Once());
        }
Beispiel #3
0
        public async Task FetchFlagsTest()
        {
            var notReadyStategy = new NotReadyStrategy(visitorDelegate);
            await notReadyStategy.FetchFlags().ConfigureAwait(false);

            fsLogManagerMock.Verify(x => x.Error(string.Format(Constants.METHOD_DEACTIVATED_ERROR, "FetchFlags", FlagshipStatus.NOT_INITIALIZED), "FetchFlags"), Times.Once());
        }
Beispiel #4
0
        public void GetFlagMetadataTest()
        {
            var notReadyStategy = new NotReadyStrategy(visitorDelegate);
            var value           = notReadyStategy.GetFlagMetadata(null, "key", false);

            Assert.AreEqual(JsonConvert.SerializeObject(FsFlag.FlagMetadata.EmptyMetadata()), JsonConvert.SerializeObject(value));

            fsLogManagerMock.Verify(x => x.Error(string.Format(Constants.METHOD_DEACTIVATED_ERROR, "flag.metadata", FlagshipStatus.NOT_INITIALIZED), "flag.metadata"), Times.Once());
        }
Beispiel #5
0
        public void GetFlagValueTest()
        {
            var defaultValue    = "defaultValue";
            var notReadyStategy = new NotReadyStrategy(visitorDelegate);
            var value           = notReadyStategy.GetFlagValue("key", defaultValue, null);

            Assert.AreEqual(defaultValue, value);

            fsLogManagerMock.Verify(x => x.Error(string.Format(Constants.METHOD_DEACTIVATED_ERROR, "Flag.value", FlagshipStatus.NOT_INITIALIZED), "Flag.value"), Times.Once());
        }
Beispiel #6
0
        public void NotReadyStrategyTest()
        {
            var notReadyStategy = new NotReadyStrategy(visitorDelegate);

            var VisitorCacheImplementation = new Mock <Flagship.Cache.IVisitorCacheImplementation>();
            var HitCaheImplementation      = new Mock <Cache.IHitCacheImplementation>();

            config.VisitorCacheImplementation = VisitorCacheImplementation.Object;
            config.HitCacheImplementation     = HitCaheImplementation.Object;

            notReadyStategy.CacheHit(flagDTO: null);
            notReadyStategy.CacheHit(hit: null);
            notReadyStategy.CacheVisitorAsync();
            notReadyStategy.LookupHits();
            notReadyStategy.LookupVisitor();

            VisitorCacheImplementation.Verify(x => x.CacheVisitor(It.IsAny <string>(), It.IsAny <JObject>()), Times.Never());
            HitCaheImplementation.Verify(x => x.CacheHit(It.IsAny <string>(), It.IsAny <JObject>()), Times.Never());
        }