public void Set_ShouldCall_OriginSet() { // Arrange const string value = "John Doe Set"; var storage = new SafeStorage <string>(_origin); // Act storage.Set(value); // Assert _origin.Received().Set(value); }
public void Set_ShouldPass_UnexpectedException() { // Arrange var exception = new Exception(); _origin.When(x => x.Set(Arg.Any <string>())).Do(_ => throw exception); ((IThrowsExpectedExceptions)_origin).IsExpectedException(Arg.Any <Exception>()).Returns(false); var storage = new SafeStorage <string>(_origin); // Act Action action = () => storage.Set("ABC"); // Assert action.Should().Throw <Exception>(); }