Example #1
0
        public void Finally()
        {
            var finallyCount = 0;
            Observation <string> observer = null;
            Observe <string>     a        = x => observer = x;
            var results = new List <IMaybe <string> >();

            a.Finally(() => finallyCount++)(results.Add);

            observer(new Some <string>("A0"));
            observer(new Some <string>("A1"));
            observer(new None <string>());
            observer(new Some <string>("After Completion"));
            Assert.AreEqual(1, finallyCount);

            Assert.AreEqual(3, results.Count);
        }