Add optional IDbConnection property decorating attributes as alternative to class attribute

Issue #8 resolved
Former user created an issue

No description provided.

Comments (3)

  1. Shane Taylor repo owner

    Yes I was thinking about this more and I think it should be possible to achieve something like the following

       public class AlternativeAttributeExample
       {
          [UsesTestDatabase] // Implicitly uses configuration for "TestDb1"
          public IDbConnection TestDb1Connection { get; set; }
    
          [UsesTestDatabase] // Implicitly uses configuration for "TestDb1"
          public Func<IDbConnection> TestDb1ConnectionFactory { get; set; }
    
          [UsesTestDatabase("MyAwesomeDatabase")] // Explicitly uses configuration for "MyAwesomeDatabase"
          public IDbConnection TestDb2Connection { get; set; }
    
          [UsesTestDatabase("MyAwesomeDatabase")] // Explicitly uses configuration for "MyAwesomeDatabase"
          public Func<IDbConnection> TestDb2ConnectionFactory { get; set; }
       }
    

    Since we have configuration for the databases, it makes sense that the Database Technology should be configurable through the same means, avoiding the need for the typeof(SqlLocalDbProvider) currently in the class level UsesDatabasesAttribute.

    It also makes the Property and the Attribute more "connected". Currently the attribute feels a bit disconnected from the properties.

  2. Former user Account Deleted

    Resolved issue# 11. UnitTestingBits library is now able to log to the XUnit output window correctly. Resolved issue# 8. Connection properties can now be decorated with the [Connection] attribute to designate them as a connection to populate. Resolved issue# 9. Default database provider is now able to be specified in configuration. Fixed issue with tests not behaving as expected. Cause was broken TestSetup code.

    → <<cset 8ad0e436e58b>>

  3. Log in to comment