Beispiel #1
0
        public void SampleTest()
        {
            var reader = new ReaderStub(new[] { "1", "0", "1", "0", "1" });
            var length = 0;

            using (var calculator = new ConsequentOnesCalculator(reader))
            {
                length = calculator.GetOnesLongestSequenceLength(5);
            }
            Assert.AreEqual(1, length);
        }
Beispiel #2
0
 public void Sample2Test()
 {
     using (var reader = new ReaderStub(new[] { 2, 2, 2, 8, 8 }))
         using (var writer = new WriterMock())
         {
             var calculator = new DuplicateCalculator(reader, writer);
             calculator.WriteUnique(5);
             Assert.AreEqual(2, writer.GetNumber());
             Assert.AreEqual(8, writer.GetNumber());
         }
 }
Beispiel #3
0
        public void OnlyZeroTest()
        {
            var reader = new ReaderStub(new[] { "0" });
            var length = 0;

            using (var calculator = new ConsequentOnesCalculator(reader))
            {
                length = calculator.GetOnesLongestSequenceLength(1);
            }
            Assert.AreEqual(0, length);
        }