public void CreateStoredProcedure_EmptyStringStoredProcedureName_ShouldThrow() { //arrange var storedProcedureName = string.Empty; //act Action result = () => _storedProcedureFactory.CreateStoredProcedure(storedProcedureName); //assert result.Should().Throw <ArgumentException>(); }
public void WithSqlParam_Get_ShouldExecuteStoredProcedureAndReturnEntities() { //arrange var storedProcedure = _storedProcedureFactory.CreateStoredProcedure("GetEmployeeByName"); //act storedProcedure.WithSqlParam("EmployeeName", "Luke Skywalker"); var result = _context.FromSql <Employee>(storedProcedure); //assert result.Should().NotBeNullOrEmpty(); result.Count().Should().Be(1); result.First().Name.Should().Be("Luke Skywalker"); }
public async Task <IEnumerable <Employee> > GetAllAsync() { return(await _context.FromSqlAsync <Employee>(_storedProcedureFactory.CreateStoredProcedure("GetAllEmployees"))); }