示例#1
0
        public void Should_ResetSelectedUpdates_When_AddNewSearchResult()
        {
            Update3Fake update1 = new Update3Fake("update1", true);
            var         holder  = new WuUpdateHolder();

            holder.SetApplicableUpdates(ToUpdateCollection(update1));
            holder.SelectUpdate("update1");
            Assert.IsNotNull(holder.GetSelectedUpdates().Single());
            holder.SetApplicableUpdates(ToUpdateCollection(update1));
            Assert.IsFalse(holder.GetSelectedUpdates().Any());
        }
示例#2
0
        public void Should_ReplaceApplicableUpdates_When_AddNewSearchResult()
        {
            UpdateFake update1       = new UpdateFake("update1");
            UpdateFake update2       = new UpdateFake("update2");
            var        searchresult1 = ToUpdateCollection(update1);
            var        searchresult2 = ToUpdateCollection(update2);

            var holder = new WuUpdateHolder();

            holder.SetApplicableUpdates(searchresult1);
            Assert.IsTrue(holder.ApplicableUpdates.OfType <IUpdate>().Single() == update1);
            holder.SetApplicableUpdates(searchresult2);
            Assert.IsTrue(holder.ApplicableUpdates.OfType <IUpdate>().Single() == update2);
        }
示例#3
0
        public void Should_ThrowException_When_UnselectUnkownUpdate()
        {
            UpdateFake update1 = new UpdateFake("update1");
            var        holder  = new WuUpdateHolder();

            holder.SetApplicableUpdates(ToUpdateCollection(update1));
            holder.UnselectUpdate("update2");
        }
示例#4
0
        public void Should_ReturnEmtpyEnum_When_NoUpdatesAreSelected()
        {
            UpdateFake update1 = new UpdateFake("update1");
            var        holder  = new WuUpdateHolder();

            Assert.IsFalse(holder.GetSelectedUpdates().Any());
            holder.SetApplicableUpdates(ToUpdateCollection(update1));
            Assert.IsFalse(holder.GetSelectedUpdates().Any());
        }
示例#5
0
        public void Should_ReturnTrue_When_VerifySelectedUpdate()
        {
            UpdateFake update1 = new UpdateFake("update1");
            var        holder  = new WuUpdateHolder();

            holder.SetApplicableUpdates(ToUpdateCollection(update1));
            Assert.IsFalse(holder.IsSelected("update1"));
            holder.SelectUpdate("update1");
            Assert.IsTrue(holder.IsSelected("update1"));
        }
示例#6
0
        public void Should_ApplyUpdateSelection_When_UseValidUpdateId()
        {
            UpdateFake update1 = new UpdateFake("update1");
            UpdateFake update2 = new UpdateFake("update2");
            UpdateFake update3 = new UpdateFake("update3");
            var        holder  = new WuUpdateHolder();

            holder.SetApplicableUpdates(ToUpdateCollection(update1, update2, update3));
            holder.SelectUpdate("update2");
            Assert.IsTrue(holder.GetSelectedUpdates().Single() == update2);
            holder.UnselectUpdate("update2");
            Assert.IsFalse(holder.GetSelectedUpdates().Any());
        }
示例#7
0
        public void Should_NotSelectUpdates_When_AutoSelectIsDisabled()
        {
            UpdateFake update1 = new UpdateFake("update1");
            UpdateFake update2 = new UpdateFake("update2");
            UpdateFake update3 = new UpdateFake("update3");

            update2.IsMandatory = true;
            update3.IsMandatory = true;
            var holder = new WuUpdateHolder();

            holder.AutoSelectUpdates = false;
            holder.SetApplicableUpdates(ToUpdateCollection(update1, update2, update3));
            Assert.IsFalse(holder.GetSelectedUpdates().Any());
        }
示例#8
0
        public void Should_NotAllowNull_When_AddNewSearchResult()
        {
            var holder = new WuUpdateHolder();

            holder.SetApplicableUpdates(null);
        }