I've come across the equation $$\int_0^1 dx \frac{dA(x)}{dx} + B = C = \text{finite}$$ in my readings on a certain topic in physics and, in both articles i have read, the following step is taken $$\int_0^1 dx \left( \frac{dA(x)}{dx} + (B-C)\delta(1-x) \right) = \text{finite}$$
For the purposes of my question, I don't think the explicit form of the functions $A,B,C$ are of concern. The reason $\delta(1-x)$ is chosen is associated with the underlying physics which I also think is not important. It seems to me that the replacement $$1 = \int_0^1 \delta(1-x) dx$$ has been made to go from line $1$ to line $2$ in the above. $\mathbf{My\,questions\, are}$:
$1)$ Why is this replacement even correct? The zero of the delta function occurs at the edge of the interval so I don't see why the integral should evaluate to one.
$2)$ I put this integral into wolfram alpha. It returns $\int_0^1 dx \delta(1-x) = \theta(0)$, where $\theta(0)$ is the step function evaluated at zero. Upon subsequently putting $\theta(0)$ into wolfram alpha it returns $1$. So a) how is $\theta(0)$ obtained analytically and b) why is $\theta(0) = 1$?