Ejemplo n.º 1
0
        protected string runFilter(IFilter filter, IEnumerable <Item> items)
        {
            StringBuilder builder = new StringBuilder();

            foreach (var item in items.Where(i => filter.Applicable(i)))
            {
                builder.Append(getLinkItem(item));
            }

            return(builder.ToString());
        }
Ejemplo n.º 2
0
        public void AreScarabsApplicable()
        {
            string fakeStashInfo = Encoding.UTF8.GetString(Files.SampleStashWithScarab);

            filter = new ScarabFilter();

            using (var stream = GenerateStreamFromString(fakeStashInfo))
            {
                _mockTransport.Setup(m => m.GetStash(0, "", "", Realm.PC)).Returns(stream);

                var stash = _model.GetStash(0, "", "", Realm.PC);

                Assert.IsNotNull(stash);
                var test   = stash.GetItemsByTab(1);
                var scarab = stash.GetItemsByTab(1).Where(x => x is Scarab);

                Assert.AreEqual(1, scarab.Count());

                Assert.IsTrue(filter.Applicable(scarab.First()));
            }
        }
Ejemplo n.º 3
0
        public void AreDivineVesselsApplicable()
        {
            string fakeStashInfo = Encoding.UTF8.GetString(Files.SampleStashWithDivineVessel);

            filter = new DivineVesselFilter();

            using (var stream = GenerateStreamFromString(fakeStashInfo))
            {
                _mockTransport.Setup(m => m.GetStash(0, "", "", Realm.PC)).Returns(stream);

                var stash = _model.GetStash(0, "", "", Realm.PC);

                Assert.IsNotNull(stash);

                var vessel = stash.GetItemsByTab(1).Where(x => x is DivineVessel);

                Assert.AreEqual(1, vessel.Count());

                Assert.IsTrue(filter.Applicable(vessel.First()));
            }
        }