Brett gave a very good answer, so I'm only going to answer your question based on your specific examples. In this case, the correct answer should be "it did not rain yesterday." "It has not rained" is present tense, so "yesterday" wouldn't fit. "Has" should be "had."
Now, assuming that's what you meant, it's technically correct to say "it had not rained yesterday." However, out of habit, English speakers usually don't say that unless we follow up with something else. For example: "It had not rained yesterday until I went outside; then, it started raining cats and dogs" ("raining cats and dogs" is an English idiom that means "raining heavily").
I hope this helps. Please let me know if you have any more questions.