public void InsertRange()
        {
            var db = new MemoryDatabase <string, int>();
            var kt = new MockTransformer();
            var vt = new MockTransformer();

            var tdb = new TransformDatabase <string, int, int, string>
                      (
                db: db,
                keyTransformer: new ReverseTransformer <string, int>(kt),
                valueTransformer: vt
                      );

            tdb.InsertRange(new KeyValuePair <int, string>[]
            {
                new KeyValuePair <int, string>(1, "a"),
                new KeyValuePair <int, string>(2, "b"),
                new KeyValuePair <int, string>(3, "c"),
            });

            db.EnumerateAggressively(3)
            .Should()
            .BeEquivalentTo(new KeyValuePair <string, int>[]
            {
                new KeyValuePair <string, int>(kt.TransformPre(1), vt.TransformPost("a")),
                new KeyValuePair <string, int>(kt.TransformPre(2), vt.TransformPost("b")),
                new KeyValuePair <string, int>(kt.TransformPre(3), vt.TransformPost("c")),
            });
        }
Пример #2
0
        public void InsertRange()
        {
            _transformDatabase.InsertRange(_values);

            // now the memory db should have the transformed values in them
            _memoryDatabase.EnumerateAggressively(3)
            .Should()
            .BeEquivalentTo(_expectValues, "Inserting values into a transform database should insert the transformed values into the underlying database.");
        }