Ejemplo n.º 1
0
        public void Match()
        {
            var name = "test";
            var keys = new InputKey[] { Keys.A, Keys.B, Keys.C };

            var sequences = new SequenceCollection();

            sequences.Add(name, keys);

            var match = sequences.Match(out var hit, keys);

            Assert.True(match);
            Assert.Equal(name, hit.Name);
            Assert.Equal(keys, hit.Keys);
        }
Ejemplo n.º 2
0
        public void FuzzySearch()
        {
            var name = "test";
            var keys = new InputKey[] { Keys.A, Keys.B, Keys.C };

            var sequences = new SequenceCollection();

            sequences.Add(name, keys);

            var matches = sequences.FuzzySearch(2, Keys.A, Keys.B);

            Assert.Equal(1, matches.Length);
            Assert.Equal(name, matches[0].Name);
            Assert.Equal(keys, matches[0].Keys);
        }
Ejemplo n.º 3
0
 public void Can_clear_named_sequences()
 {
     var collection = new SequenceCollection();
     collection.Add("sequence");
     collection.Clear();
     Assert.False(collection.Exists("sequence"));
 }
Ejemplo n.º 4
0
 public void Can_check_if_sequence_exists()
 {
     var collection = new SequenceCollection();
     collection.Add("sequence");
     Assert.True(collection.Exists("sequence"));
 }
Ejemplo n.º 5
0
 public void Can_add_type_sequence_with_seed()
 {
     var collection = new SequenceCollection();
     collection.Add<Rabbit>(100);
     Assert.Equal(100, collection.Next<Rabbit>());
 }
Ejemplo n.º 6
0
 public void Can_add_named_type_sequence()
 {
     var collection = new SequenceCollection();
     collection.Add<Rabbit>("sequence");
     Assert.Equal(0, collection.Next<Rabbit>("sequence"));
 }
Ejemplo n.º 7
0
 public void Can_add_named_sequence_with_seed()
 {
     var collection = new SequenceCollection();
     collection.Add("sequence", 100);
     Assert.Equal(100, collection.Next("sequence"));
 }
Ejemplo n.º 8
0
 public void Can_reset_named_sequence()
 {
     var collection = new SequenceCollection();
     collection.Add("sequence");
     var value = collection.Next("sequence");
     collection.Reset();
     Assert.Equal(0, collection.Next("sequence"));
 }
Ejemplo n.º 9
0
 public void Cannot_add_duplicate_sequence()
 {
     var collection = new SequenceCollection();
     collection.Add("sequence");
     Assert.Throws<DuplicateSequenceException>(() => collection.Add("sequence"));
 }