How to generate database LocalDB with NHibernate -


'm having trouble creating test generates database read several articles using instance pipe name. not know how use!

project

it follows structure of app

creditoimobiliariobb.repository.integration.test

for testings nhibernate , localdb

file app.config

<configsections>     <section name="hibernate-configuration" type="nhibernate.cfg.configurationsectionhandler, nhibernate" /> </configsections>  <appsettings>     <add key="fluentassertions.testframework" value="mstest"/> </appsettings>  <connectionstrings>     <clear/>     <add         name="datanp"         connectionstring="np:\\.\pipe\localdb#53edc7c5\tsql\query"         providername="system.data.sqlclient"/>     <add         name="data"         connectionstring="data source=(localdb)\projects;initial catalog=sistema.creditodobrasil.test;integrated security=true;connect timeout=15;encrypt=false;trustservercertificate=false"         providername="system.data.sqlclient"/> </connectionstrings>  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">     <session-factory>         <property name="connection.provider">nhibernate.connection.driverconnectionprovider</property>         <property name="dialect">nhibernate.dialect.mssql2008dialect</property>         <property name="connection.connection_string_name">datanp</property>         <property name="show_sql"></property>     </session-factory> </hibernate-configuration> 

comments in http://chopapp.com/#3tiok8u9

file databaserepositorytest

[testclass] public class databaserepositorytest {     protected isession session { get; private set; }     private static isessionfactory _sessionfactory;     private static configuration _configuration;      [testinitialize]     public void setup()     {         _configuration = new nhibernate.cfg.configuration();         _sessionfactory = fluently.configure(_configuration)                 .mappings(m => m.fluentmappings.addfromassemblyof<usuario>())                 .buildsessionfactory();          session = _sessionfactory.opensession();          var export = new schemaexport(_configuration);         export.execute(true, true, true, session.connection, null);     }      [testmethod]     public void createatpreenchidapelodatabase()     {         // arrange         var usuario = new usuario();          // action         using (var session = _sessionfactory.opensession())         {             session.saveorupdate(usuario);             session.flush();         }          // assert         usuario.createat.should().becloseto(datetime.now, 200);     } } 

comments in: http://chopapp.com/#i6bosycr

creditoimobiliariobb.repository

file usuariomap

public class usuariomap : classmap<usuario> {     public usuariomap()     {         id( p => p.id);         map(p => p.name).not.nullable().asname();         map(p => p.email).not.nullable().asemail();         map(p => p.emailpessoal).not.nullable().asemail();         references(p => p.status).not.nullable();         map(p => p.bloquearate).nullable();         references(p => p.photo).nullable();         map(p => p.datanascimento).nullable();          map(p => p.createat).ascreateat();         map(p => p.updateat).asupdateat();          table("usuarios");     } } 

comments in http://chopapp.com/#8v8ulqj6

error

with connectionstirng "data" error: no persister for: creditoimobiliariobb.model.usuario

with connectionstirng "datanp" error: format of initialization string not conform specification starting @ index 0. on fluently.configure

question?

how create , configure test stop generating database nhibernate, , localdb msteste?


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -