public void Log_DoesNotFail_IfLengthExceedsLimits() { Migrate(m => m.Logger.Log(new string('#', 9000))); var log = MigrationRecords.GetAll().Last().Log; Assert.AreEqual(log.Length, MigrationRecord.DefaultMaxLogLength); }
public void Save_InsertsNewRecord_IfItDidNotExist() { var record = new MigrationRecord { Version = Guid.NewGuid().ToString("N"), Name = "Test", DateExecuted = DateTime.Now }; MigrationRecords.Save(new[] { record }); var found = MigrationRecords.GetAll().SingleOrDefault(r => r.Version == record.Version); Assert.IsNotNull(found); }
public void Save_UpdatesExistingRecord() { var record = new MigrationRecord { Version = Guid.NewGuid().ToString("N"), Name = "Old", DateExecuted = DateTime.Now }; MigrationRecords.SaveNew(record); record.Name = "New"; MigrationRecords.Save(new[] { record }); var reloaded = MigrationRecords.GetAll().Single(r => r.Version == record.Version); Assert.AreEqual("New", reloaded.Name); }
public void ChangeAllPropertyValues_DoesNotLogChangeWhenValuesAreSame() { var id = Guid.NewGuid(); IContent content; Prepare(m => { var dataType = m.DataTypes.Add("Test", Constants.PropertyEditors.NoEditAlias, id); var contentType = m.ContentTypes .Add("contentType", "Content Type") .PropertyGroup(null).AddProperty("property", "Property", dataType.Object); content = Services.ContentService.CreateContent("Content", -1, contentType.Object.Alias); content.SetValue("property", "TestPropertyValue"); Services.ContentService.Save(content); }); Migrate(m => m.DataType("Test").ChangeAllPropertyValues <string, string>(s => s)); var record = MigrationRecords.GetAll().Last(); StringAssert.DoesNotContain("TestPropertyValue", record.Log); }