コード例 #1
0
        public void SaveConfigurationShouldReturnValueUpdated()
        {
            var manager = new MyEntityManager(contextGenerator);

            var entity = manager.GetMyEntity();

            entity.Name = "TEST UPDATE";
            manager.SaveMyEntity(entity);
            var entitySaved = manager.GetMyEntity();

            Assert.NotNull(entity);
            Assert.NotNull(entitySaved);
            Assert.AreEqual(entity.Name, entitySaved.Name);
            Assert.AreEqual("TEST UPDATE", entitySaved.Name);
        }
コード例 #2
0
        public void GetMyEntityShouldReturnEntity()
        {
            var contextGenerator = new DbContextGenerator(options);
            var manager          = new MyEntityManager(contextGenerator);

            var entity = manager.GetMyEntity();

            Assert.NotNull(entity);
            Assert.AreEqual(1, entity.Id);
        }
コード例 #3
0
        public void GetConfigurationShouldReturnConfig()
        {
            var manager = new MyEntityManager(contextGenerator);

            var entity = manager.GetMyEntity();

            Assert.NotNull(entity);
            Assert.AreEqual(1, entity.Id);
            Assert.AreEqual("TEST NAME", entity.Name);
        }
コード例 #4
0
        public void SaveMyEntityShouldReturnValueUpdated()
        {
            var          contextGenerator = new DbContextGenerator(options);
            var          manager          = new MyEntityManager(contextGenerator);
            const string nameToUpdate     = "INTEGRATION TEST";

            var entity        = manager.GetMyEntity();
            var originalValue = entity.Name;

            entity.Name = nameToUpdate;
            manager.SaveMyEntity(entity);
            var entitySaved = manager.GetMyEntity();

            Assert.NotNull(entity);
            Assert.NotNull(entitySaved);
            Assert.AreEqual(entity.Name, entitySaved.Name);
            Assert.AreEqual(nameToUpdate, entitySaved.Name);

            entitySaved.Name = originalValue;
            manager.SaveMyEntity(entitySaved);
        }