Cannot convert Dynamic table entity to System.threading entity in assert

ankit

I am trying to implement an Assert over my function which is called in separate project. The function called is as follows:

public async Task<List<DynamicTableEntity>> PopulateTable(
        string documentId,
        IEnumerable<string> lines,
        JsonSchema schema,
        string type,
        string subType,
        string format,
        bool upsert ){var tableEntries = new List<DynamicTableEntity>( tableData.Count );
.....
return tableEntries;  }

In Some cases it will throw an exception and I would like to test that using Xunit framework. My TDD code is like this:

 public async Task UploadAndSchemaCheckOnMissingKey()
 {      
    var table = await _tableStore.PopulateTable(null, lines, schema, "tableOutput", null, "test", false);
       
    await Assert.ThrowsAsync<ArgumentException>(table);
 }

I get the error as cannot convert System.Collection.generic.List<table.DynamicEntity> to System.Func<System.Threading.tasks.task>.

How should I handle this that My test case pass when the exception is thrown?

Ankit Kumar

You can use it something like this:

Func<Task> table = async() => await _tableStore.PopulateTable(null, lines, schema, "tableOutput", null, "test", false);
var ex = await Assert.ThrowsAsync<FormatException>(table);
Assert.Contains("expected error message", ex.Message);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Argument 1: cannot convert from 'Moq.Mock<System.Data.Entity.DbContext>' to 'System.Data.Entity.DbContext'

From Dev

Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Data.Entity.Infrastructure.DbQuery'

From Dev

Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Data.Entity.DbSet'

From Dev

Cannot implicitly convert type System.Data.Entity.Core.Objects.ObjectResult to System.Data.Objects.ObjectResult

From Dev

cannot implicitly convert type system.data.entity.infrastructure.DbRawSqlQuery<> . An explicit conversion exists

From Dev

Adding Dependency Injection: "Cannot convert Project.Models.IApplicationDbContext to System.Data.Entity.DbContext"

From Dev

Dynamic table names in Entity Framework linq

From Dev

Entity Framework one to many: cannot implicitly convert

From Dev

Cannot implicitly convert type 'System.Data.EntityState' to 'System.Data.Entity.EntityState'. An explicit conversion exists (are you missing a cast?)

From Dev

Cannot implicitly convert type 'void' to 'System.Threading.Tasks.Task'

From Dev

Cannot implicitly convert type 'bool' to 'System.Threading.Tasks.Task'

From Dev

Assert.IsInstanceOfType cannot convert from object to System.Type

From Dev

Assert.IsInstanceOfType cannot convert from object to System.Type

From Dev

System.Data.Entity.DbSet cannot be called with instance of type System.Data.Entity.Core.Objects.ObjectQuery

From Dev

I cannot find System.Data.Entity.Validation in EntityFramework 5

From Dev

cannot convert from Models.<entityviewmodel> to Models.<entity>

From Dev

Cannot convert from java.lang.Thread to entity.Thread

From Dev

ASP.NET Entity framework Cannot implicitly convert type

From Dev

Hibernate dynamic entity model

From Dev

Cannot implicitly convert type 'System.Collections.Generic.List<>' to 'System.Threading.Tasks.Task<>>

From Dev

Cannot convert from 'System.Threading.Tasks.Task' to 'System.Collections.Generic.Dictionary<string,string>'

From Dev

Cannot convert from 'System.Threading.Tasks.Task' to 'System.Collections.Generic.Dictionary<string,string>'

From Dev

Cannot convert from 'void' to System.Threading.Tasks.Task<System.Action>

From Dev

How to convert table data to Excel format in an Entity Framework project?

From Dev

Can i convert from table to list in Entity Framework

From Dev

Symfony 3.1 Doctrine Entity Cannot alter table add foreign key

From Dev

Cannot use table 'AspNetUsers' in schema '' for entity 'AspNetUsers' since it is being used for another entity

From Dev

Does Entity Framework support Multi-Threading?

From Dev

How to set threading mode in SQLite with Entity Framework?

Related Related

  1. 1

    Argument 1: cannot convert from 'Moq.Mock<System.Data.Entity.DbContext>' to 'System.Data.Entity.DbContext'

  2. 2

    Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Data.Entity.Infrastructure.DbQuery'

  3. 3

    Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Data.Entity.DbSet'

  4. 4

    Cannot implicitly convert type System.Data.Entity.Core.Objects.ObjectResult to System.Data.Objects.ObjectResult

  5. 5

    cannot implicitly convert type system.data.entity.infrastructure.DbRawSqlQuery<> . An explicit conversion exists

  6. 6

    Adding Dependency Injection: "Cannot convert Project.Models.IApplicationDbContext to System.Data.Entity.DbContext"

  7. 7

    Dynamic table names in Entity Framework linq

  8. 8

    Entity Framework one to many: cannot implicitly convert

  9. 9

    Cannot implicitly convert type 'System.Data.EntityState' to 'System.Data.Entity.EntityState'. An explicit conversion exists (are you missing a cast?)

  10. 10

    Cannot implicitly convert type 'void' to 'System.Threading.Tasks.Task'

  11. 11

    Cannot implicitly convert type 'bool' to 'System.Threading.Tasks.Task'

  12. 12

    Assert.IsInstanceOfType cannot convert from object to System.Type

  13. 13

    Assert.IsInstanceOfType cannot convert from object to System.Type

  14. 14

    System.Data.Entity.DbSet cannot be called with instance of type System.Data.Entity.Core.Objects.ObjectQuery

  15. 15

    I cannot find System.Data.Entity.Validation in EntityFramework 5

  16. 16

    cannot convert from Models.<entityviewmodel> to Models.<entity>

  17. 17

    Cannot convert from java.lang.Thread to entity.Thread

  18. 18

    ASP.NET Entity framework Cannot implicitly convert type

  19. 19

    Hibernate dynamic entity model

  20. 20

    Cannot implicitly convert type 'System.Collections.Generic.List<>' to 'System.Threading.Tasks.Task<>>

  21. 21

    Cannot convert from 'System.Threading.Tasks.Task' to 'System.Collections.Generic.Dictionary<string,string>'

  22. 22

    Cannot convert from 'System.Threading.Tasks.Task' to 'System.Collections.Generic.Dictionary<string,string>'

  23. 23

    Cannot convert from 'void' to System.Threading.Tasks.Task<System.Action>

  24. 24

    How to convert table data to Excel format in an Entity Framework project?

  25. 25

    Can i convert from table to list in Entity Framework

  26. 26

    Symfony 3.1 Doctrine Entity Cannot alter table add foreign key

  27. 27

    Cannot use table 'AspNetUsers' in schema '' for entity 'AspNetUsers' since it is being used for another entity

  28. 28

    Does Entity Framework support Multi-Threading?

  29. 29

    How to set threading mode in SQLite with Entity Framework?

HotTag

Archive