Exemplo n.º 1
0
        public void TestUpdateIsON()
        {
            //Given
            Toggle tog1 = new Toggle("feature-alpha");
            ToggleRepositoryInMemory repo = new ToggleRepositoryInMemory();

            //When
            var toggle = repo.put(tog1);

            //Then
            Assert.False(toggle.isON);

            //When
            toggle.isON = true;
            toggle      = repo.update(toggle);

            //Then
            Assert.True(toggle.isON);
        }
Exemplo n.º 2
0
        public void TestUpdateBL()
        {
            //Given
            Toggle tog1 = new Toggle("feature-alpha");
            App    app1 = new App("alpha", "1");
            ToggleRepositoryInMemory repo = new ToggleRepositoryInMemory();

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

            //Then
            Assert.True(toggle.GetBlackList().Count == 1);

            //When
            tog1.RemoveAllFromBL();
            toggle = repo.update(tog1);

            //Then
            Assert.True(toggle.GetBlackList().Count == 0);
        }
Exemplo n.º 3
0
        public void TestUpdateWL()
        {
            //Given
            ToggleRepositoryInMemory repo = new ToggleRepositoryInMemory();

            Toggle tog1 = new Toggle("feature-alpha");
            App    app1 = new App("alpha", "1");

            tog1.AddToList(BWList.ListColor.WHITE, app1);

            Toggle tog2 = new Toggle("feature-zulu");
            App    app2 = new App("x-ray", "1");

            tog2.AddToList(BWList.ListColor.WHITE, app2);

            //When
            var toggle = repo.put(tog1);

            toggle.RewriteBW(BWList.ListColor.WHITE, tog2.GetWhiteList());
            Toggle current = repo.update(toggle);

            //Then
            Assert.Equal(tog2.GetWhiteList(), current.GetWhiteList());
        }