unit testing with effort for entity framework 6 with computed values


Using effort EF6 with code first does not populate computed values. I have a datetime field (FechaCreacion) that is computed. How can I emulate it in Effort, so It is populated with DateTime.Now after savingChanges() ?

This post Using Effort (EF Testing Tool) with Computed Column is DB First instead of Code First as my example, but seems unanswered too.

EffortConnection connection = (EffortConnection)DbConnectionFactory.CreateTransient();

using (var c = new ControlConfigContext(connection))


    string direccionMac = "FFFF";
    var repo = new CambioRepository(c);
    var primerConcesionarioTerminal = repo.GetPrimerConcesionarioTerminal(direccionMac);

    Assert.AreEqual("terminal1", primerConcesionarioTerminal.Terminal);

This value is computed in SQLServer as GetDate()

this.Property(t => t.FechaCreacion).HasColumnName("FechaCreacion").HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);

In sql server works well, but when using Effort in unit testing, the field gets empty date value.

enter image description here

Popular Answer

This would seem like an issue with Effort. I have opened an issue on their github site: https://github.com/tamasflamich/effort/issues/62

Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why