Пример #1
0
        public void Given_Null_Value_When_ThrowIfNullOrDefault_Invoked_Then_It_Should_Throw_Exception()
        {
            var value = (object)null;

            Action action = () => GenericExtensions.ThrowIfNullOrDefault(value);

            action.Should().Throw <ArgumentNullException>();
        }
        public void Given_Null_ThrowIfNullOrDefault_ShouldThrow_Exception()
        {
            Action action = () => GenericExtensions.ThrowIfNullOrDefault((object)null);

            action.ShouldThrow <ArgumentNullException>();

            action = () => GenericExtensions.ThrowIfNullOrDefault(default(object));
            action.ShouldThrow <ArgumentNullException>();
        }
Пример #3
0
        public void Given_Default_Value_When_ThrowIfNullOrDefault_Invoked_Then_It_Should_Return_Result()
        {
            var value = new object();

            var result = GenericExtensions.ThrowIfNullOrDefault(value);

            result
            .Should().NotBeNull()
            .And.BeOfType <object>();
        }
        public void Given_Value_ThrowIfNullOrDefault_ShouldReturn_Object()
        {
            var result = GenericExtensions.ThrowIfNullOrDefault(new object());

            result.Should().BeOfType <object>();
        }