Exemplo n.º 1
0
        public void TestGetTooglesForAppWhenMultipleApps()
        {
            //Given
            var app1 = new App("app1", "v1");
            var app2 = new App("app2", "v1");
            var app3 = new App("app3", "v1");
            var tog1 = new Toggle("feature-alpha");
            var tog2 = new Toggle("feature-bravo");
            var repo = new ToggleRepositoryInMemory();

            //When
            repo.put(tog1); // NOTE no BL nor WL
            repo.put(tog2); // all apps can use these toggles

            //Then
            var dicApps = new Dictionary <int, App>();

            dicApps.Add(1, app1);
            dicApps.Add(2, app2);
            dicApps.Add(3, app3);

            foreach (KeyValuePair <int, App> pair in dicApps)
            {
                var current  = repo.getTogglesForApp(pair.Value).Count;
                var expected = 2;
                Assert.True(current == expected);
            }
        }
Exemplo n.º 2
0
        public void TestGetTooglesForAppWhenAppIsOnWL()
        {
            //Given
            var app1 = new App("app1", "v1");
            var tog1 = new Toggle("feature-alpha");
            var repo = new ToggleRepositoryInMemory();

            //When
            tog1.AddToList(BWList.ListColor.WHITE, app1);
            repo.put(tog1);

            var app1_toggles = repo.getTogglesForApp(app1);

            //Then
            var current  = app1_toggles.Count;
            var expected = 1;

            Assert.True(current == expected);
        }
Exemplo n.º 3
0
        public void TestGetTooglesForAppWhenTogglesWithNoWLNorBL()
        {
            //Given
            var app1 = new App("app1", "v1");
            var tog1 = new Toggle("feature-alpha");
            var tog2 = new Toggle("feature-bravo");
            var repo = new ToggleRepositoryInMemory();

            //When
            repo.put(tog1); // NOTE no BL nor WL
            repo.put(tog2); // all apps can use these toggles

            var app1_toggles = repo.getTogglesForApp(app1);

            //Then
            var current  = app1_toggles.Count;
            var expected = 2;

            Assert.True(current == expected);
        }
Exemplo n.º 4
0
        public void TestGetTooglesForAppWhenAppIsBlackListedOnAllToogles()
        {
            //Given
            var app1 = new App("app1", "v1");
            var tog1 = new Toggle("feature-alpha");
            var tog2 = new Toggle("feature-bravo");
            var repo = new ToggleRepositoryInMemory();

            //When
            tog1.AddToList(BWList.ListColor.BLACK, app1);
            repo.put(tog1);

            tog2.AddToList(BWList.ListColor.BLACK, app1);
            repo.put(tog2);

            var app1_toggles = repo.getTogglesForApp(app1);

            //Then
            var current  = app1_toggles.Count;
            var expected = 0;

            Assert.True(current == expected);
        }