Testing ServiceController Class
You'll have to do something like (this will work for Moq, change the api usage to match your Mocking framework). 

_controller.Setup(p=&gt;p.ServerNameOrIP).Returns("testServerName");


before you call your assert statement.