I’ve got a little question for you. What happens if you run the following test? Try to answer without actually running it! Note that there is no additional test setup.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class UnitTest
{
public static CustomerMetaData UnitUnderTest;

[Test]
public void NameProperty_Should_Be_Firstname()
{
Assert.That(UnitUnderTest.NameProperty, Is.EqualTo("Firstname"));
}
}

public struct CustomerMetaData
{
public string NameProperty
{
get { return "Firstname"; }
}

public string JoinedProperty
{
get { return "JoinedAt"; }
}
}

Update: The answer is that the test will pass and there’ll be no NullReferenceException (if that’s what you’ve guessed). The reason? Because CustomerMetaData is not a class and is a struct, which by definition can never be null.