public void Instance_WhenDefaultDelegateSupplied_ShouldReturnInstance() { var sut = new AmbientServiceWithDefault(); var instance = sut.Instance; instance.Should().BeOfType <Foo>(); }
public void Instance_WhenInstanceSetToNull_ShouldThrow() { AmbientServiceWithDefault.Create = () => new Foo2(); var sut = new AmbientServiceWithDefault(); Action setInstanceToNull = () => sut.Instance = null; setInstanceToNull.ShouldThrow <ArgumentNullException>(); }
public void Instance_WhenDefaultDelegateSuppliedAndCreateSet_ShouldReturnCreateInstance() { AmbientServiceWithDefault.Create = () => new Foo2(); var sut = new AmbientServiceWithDefault(); var instance = sut.Instance; instance.Should().BeOfType <Foo2>(); }
public void Instance_WhenInstanceSet_ShouldReturnInstance() { AmbientServiceWithDefault.Create = () => new Foo2(); var sut = new AmbientServiceWithDefault(); sut.Instance = new Foo(); var instance = sut.Instance; instance.Should().BeOfType <Foo>(); }