Base solution for your next web application
Open Closed

ABP Unit Test Error #1471


User avatar
0
jackywang created

Hi hikanlkan,

I met the error 'The sequence does not contain any matching elements' when I did the unit test of abp. I took me a long time to find the error code. My entity has the column attribute for one property like that: [Column(TypeName = "varchar")] public virtual string Picture { get; set; }

When I used the method of UsingDbContext of AppTestBase , the error was throw. I don't konw why the column attribute causes the error?


4 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    This can be related to EF rather than ABP. I found that when I search it: <a class="postlink" href="http://stackoverflow.com/questions/12500625/entity-framework-migrations-error-sequence-contains-no-elements">http://stackoverflow.com/questions/1250 ... o-elements</a>

    Can you share the stack trace?

  • User Avatar
    0
    jackywang created

    Stack Trace is like below: [External code]

    Abp.EntityFramework.dll!Abp.EntityFramework.AbpDbContext.Initialize() line 137 C# [External code] Abp.dll!Abp.Dependency.IocManager.Resolve<AndHuang.HWWL.EntityFramework.HWWLDbContext>() line 159 C# AndHuang.HWWL.dll!AndHuang.HWWL.Tests.AppTestBase.UsingDbContext(System.Action<AndHuang.HWWL.EntityFramework.HWWLDbContext> action) line 67 C# AndHuang.HWWL.dll!AndHuang.HWWL.Tests.AppTestBase.AppTestBase() line 34 C# AndHuang.HWWL.dll!AndHuang.HWWL.Test.Sms.SmsManager_Tests.SmsManager_Tests() line C# [External code]

    I viewed the link you provided ,I guess it may be a bug of EF CodeFirst. .

  • User Avatar
    0
    hikalkan created
    Support Team

    See #1360

  • User Avatar
    0
    jackywang created

    Thanks a lot , it gave me much help.