Skip to content

Instantly share code, notes, and snippets.

@Keboo
Last active July 2, 2020 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Keboo/de8b28128e4952444cddffc054a7f819 to your computer and use it in GitHub Desktop.
Save Keboo/de8b28128e4952444cddffc054a7f819 to your computer and use it in GitHub Desktop.
Brain Teaser: Collection fun

Brain Teaser: Update the above code such that that unit tests pass. Do not update the content of the unit tests (however you are allowed to switch off of xUnit if you like).

namespace CollectionTests
{
public class HazStuff
{
//TODO
}
public class Tests
{
[Fact]
public void CanAddStringz()
{
var stuff = new HazStuff
{
Stuff = { "thing1", "thing2" }
};
Assert.Equal(new[] { "thing1", "thing2" }, stuff.Stuff);
}
[Fact]
public void CanAddNumberz()
{
var stuff = new HazStuff
{
Stuff = { 41, 42 }
};
Assert.Equal(new[] { "thing41", "thing42" }, stuff.Stuff);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment