Exemplo n.º 1
0
        public void InsertBook()
        {
            var sqlConnectionStrings = new Dictionary <DatabaseEnum, string>();

            sqlConnectionStrings.Add(DatabaseEnum.SqlConnection, "Server=DESKTOP-CKLQMTC\\SQLEXPRESS;Database=Ineor;Trusted_Connection=True;MultipleActiveResultSets=true");

            var sqlConnectionDapper = new SqlConnectionDapper(sqlConnectionStrings);

            var data = new Book()
            {
                Author        = "Test",
                DatePublished = DateTime.Now.Date,
                Name          = "Test Name",
                Price         = 2
            };

            var bookRepository = new BookRepository(sqlConnectionDapper);

            var component = new BookService(bookRepository);

            //INSERT
            var result = component.InsertBook(data);

            Assert.True(result);
        }
Exemplo n.º 2
0
 public BookRepository(SqlConnectionDapper db)
 {
     this._db = db.SQLConnection();
 }