mardi 16 avril 2019

When using inlinedata is it possible to use string.empty?

I was wondering while writing some tests if it was possible to use the by @microsoft declared string.isempty when using xUnit tests. (See below)

I'm a programming student and my teachers recommended using @microsofts already defined methods and consts when possible.

I've tried it but it didn't seemed to work, so thought I might have done something wrong.

[Theory]
[InlineData(string.Empty)]
[InlineData(null)]
[InlineData("        ")]
[InlineData(" ")]
[InlineData(" someRandomText")]
// ... 
public void SetEmailaddress_WrongEmail_IllegalArgumentException(string data) // type of method that is being test, what kind of test, the expected outcome
   {
      //Assert
      Assert.Throws<ArgumentException>(() => _l.Emailaddress = data);
   }

Thanks in advance!

Greetingz

Aucun commentaire:

Enregistrer un commentaire