# What is the correct way to make \setmainfont take effect?

\documentclass{article}
\usepackage{fontspec}

\setmainfont[BoldItalicFont={Times New Roman}]{DejaVu Sans}

\begin{document}

1. This is normal as expected.

\textit{2. This is in italic as expected.}

\textbf{3. This is in bold as expected.}

\textit{\textbf{4. This is NOT in italic and bold as expected.}}

\textbf{\textit{5. This is NOT in bold and italic as expected.}}

\end{document}


The output is as below:

What is the correct way to make \setmainfont[BoldItalicFont={Times New Roman}]{DejaVu Sans} take effect?

You are telling fontspec that whenever a bold italic font is requested, it should use upright regular Times New Roman.
You should write BoldItalicFont={Times New Roman Bold Italic} instead.

Stylish comment:
Using both bold and italic is generally considered a bad practice (and, in my opinion, Times New Roman Bold Italic is absolutely ugly). It also matches very poorly Dejavu Sans, so please consider a different serif/sans serif font couple.

\documentclass{article}
\usepackage{fontspec}

\setmainfont[BoldItalicFont={Times New Roman Bold Italic}]{DejaVu Sans}

\begin{document}
1. This is normal as expected.
\textit{2. This is in italic as expected.}
\textbf{3. This is in bold as expected.}
\textit{\textbf{4. This is in italic and bold as expected.}}
\textbf{\textit{5. This is in bold and italic as expected.}}
\end{document}