public void TestLocalizedRevision()
        {
            DbTest(database =>
              {
            // Update object
            var cmsHandler = new cms_handler(database);
            var id = Mocks.BsonDocumentMock["_id"].AsObjectId;
            var cmsParameter = new cms_update_parameter
            {
              id = id,
              collection = "entities",
              field = "Biography",
              language = "DE",
              value = new BsonString("Eine neue Biography!")
            };
            var cmsResponse = cmsHandler.revise(cmsParameter);

            // Check that the update was successful
            Assert.IsTrue(cmsResponse.success);

            // Check that reduced entity has the expected value
            var actual = cmsHandler.getCurrent("entities", id, "DE");
            actual.OrderFields();
            var expected = Mocks.BsonDocumentMock.DeepClone().AsBsonDocument;
            expected = expected.Current().AsBsonDocument;
            expected["Biography"] = new BsonString("Eine neue Biography!");
            expected.OrderFields();
            Assert.AreEqual(expected, actual);
              });
        }
 /// <summary>
 /// Create a new instance.
 /// </summary>
 /// <param name="parameter">Cms parameter.</param>
 public cms_update_response(cms_update_parameter parameter)
 {
     collection = parameter.collection;
       id = parameter.id;
       field = parameter.field;
       language = parameter.language;
       value = parameter.value;
       success = false;
       message = string.Empty;
 }
        public void TestUpdate()
        {
            DbTest(database =>
              {
            // Update object
            var cmsHandler = new cms_handler(database);
            var id = Mocks.BsonDocumentMock["_id"].AsObjectId;
            var cmsParameter = new cms_update_parameter
            {
              id = id,
              collection = "entities",
              field = "Simple",
              value = new BsonString("New value.")
            };
            var cmsResponse = cmsHandler.update(cmsParameter);

            // Check that the update was successful
            Assert.IsTrue(cmsResponse.success);

            // Check that reduced entity has the expected value
            var actual = cmsHandler.getCurrent("entities", id);
            actual.OrderFields();
            var expected = Mocks.BsonDocumentMock.DeepClone().AsBsonDocument;
            expected = expected.Current().AsBsonDocument;
            expected["Simple"] = new BsonString("New value.");
            expected.OrderFields();
            Assert.AreEqual(expected, actual);
              });
        }
Example #4
0
 public cms_update_response update(cms_update_parameter parameter)
 {
     return update(new List<cms_update_parameter> { parameter }).Single();
 }