public void UsingCompositeKey_UpdatesEntity()
        {

            var multiKeyRepository = Container.Resolve<IRepository<Multikey>>();

            var m = new Multikey { Key2 = "key", Value = "foo" };
            var key = multiKeyRepository.Insert(m);
            Assert.AreEqual("key", key.Key2);

            int key1 = key.Key1;
            string key2 = key.Key2;

            Multikey m2 = multiKeyRepository
                .Query(e => e.Key1 == key1 && e.Key2 == key2)
                .Single();
            m2.Key2 = "key";
            m2.Value = "barz";
            multiKeyRepository.Update(m2);

            Multikey m3 = multiKeyRepository
                .Query(e => e.Key1 == key1 && e.Key2 == key2)
                .Single();

            Assert.AreEqual(key1, m3.Key1);
            Assert.AreEqual("key", m3.Key2);
            Assert.AreEqual("barz", m3.Value);
        }
        public void AddsEntityTo_database_ReturnsCompositeKey()
        {
            var multiKeyRepository = Container.Resolve<IRepository<Multikey>>();

            var m = new Multikey { Key2 = "key", Value = "foo" };
            var key = multiKeyRepository.Insert(m);

            Assert.AreEqual(1, key.Key1);
            Assert.AreEqual("key", key.Key2);
        }
        public void UsingCompositeKey_DeletesFrom_database()
        {
            var multiKeyRepository = Container.Resolve<IRepository<Multikey>>();

            var m1 = new Multikey { Key2 = "key", Value = "bar" };
            dynamic key = multiKeyRepository.Insert(m1);
            int key1 = key.Key1;
            string key2 = key.Key2;

            Multikey m2 = multiKeyRepository
                .Query(e => e.Key1 == key1 && e.Key2 == key2)
                .Single();

            bool success = multiKeyRepository.Delete(m2);

            Assert.IsTrue(success);
        }
        public void UsingCompositeKey_ReturnsEntity()
        {
            var multiKeyRepository = Container.Resolve<IRepository<Multikey>>();

            var m1 = new Multikey { Key2 = "key", Value = "bar" };
            dynamic key = multiKeyRepository.Insert(m1);
            int key1 = key.Key1;
            string key2 = key.Key2;

            Multikey m2 = multiKeyRepository
                .Query(e => e.Key1 == key1 && e.Key2 == key2)
                .Single();

            Assert.AreEqual(key.Key1, m2.Key1);
            Assert.AreEqual("key", m2.Key2);
            Assert.AreEqual("bar", m2.Value);
        }