コード例 #1
0
        public void TestMethod5()
        {
            var ex = new ArgumentException();

            ex.Should().BeAssignableTo <Exception>("because it is an exception");
            ex.Should().NotBeAssignableTo <DateTime>("because it is an exception");

            var dummy = new Object();

            dummy.Should().Match(d => (d.ToString() == "System.Object"));
            dummy.Should().Match <string>(d => (d == "System.Object"));
            dummy.Should().Match((string d) => (d == "System.Object"));
        }
コード例 #2
0
        public void AddMethodResultCachingWithNonVirtualMethodThrowsException()
        {
            IServiceCollection serviceCollection = null;

            "Given a service collection".x(() =>
            {
                serviceCollection = new ServiceCollection();
            });

            "And a service implementation with a non virtual cachable method".x(() =>
            {
                serviceCollection
                .AddSingleton <FailingUserService>();
            });

            ArgumentException argumentException = null;

            "When registering method result caching".x(() =>
            {
                try
                {
                    serviceCollection
                    .AddMethodResultCaching();
                }
                catch (ArgumentException argEx)
                {
                    argumentException = argEx;
                }
            });

            "Then an argument exception occurs".x(() =>
            {
                argumentException.Should().NotBeNull();
            });
        }
コード例 #3
0
        public void passed_empty_password_throw_exception()
        {
            // Act
            ArgumentException exception = null;

            try
            {
                var result = Execution();
            }
            catch (ArgumentException ex)
            {
                exception = ex;
            }

            // Assert
            exception.Should().NotBeNull();
            exception.Message.Should().BeEquivalentTo("Can not generate hash from an empty value.\r\nParameter name: password");
        }
コード例 #4
0
        public void TestBruteForceLessThan10Players()
        {
            ArgumentException ex = null;

            ICollection <PlayerModel> blueTeam = GetPlayerCollectionHelper(0);
            ICollection <PlayerModel> redTeam  = GetPlayerCollectionHelper();

            try
            {
                IBalancingStrategy strategy = new BruteForceBalancingStrategy();

                strategy.Balance(blueTeam, redTeam);
            }
            catch (ArgumentException e)
            {
                ex = e;
            }

            ex.Should().NotBe(null);
        }
コード例 #5
0
        public void salt_is_empty_throw_exception()
        {
            // Arrange
            password = "******";

            // Act
            ArgumentException exception = null;

            try
            {
                var result = Execution();
            }
            catch (ArgumentException ex)
            {
                exception = ex;
            }

            // Assert
            exception.Should().NotBeNull();
            exception.Message.Should().BeEquivalentTo($"Can not use an empty salt from hashing value.\r\nParameter name: salt");
        }
コード例 #6
0
 public void Then_It_Should_Return_An_ArgumentException()
 {
     _argumentException.Should().NotBeNull();
 }
コード例 #7
0
 public void Then_It_Should_Throw_An_ArgumentException()
 {
     _exception.Should().NotBeNull();
 }
コード例 #8
0
 public void ShouldThrowAnArgumentException() =>
 _exception.Should().NotBeNull();
コード例 #9
0
        public void Object_should_be_assignable_to_Example()
        {
            var ex = new ArgumentException();

            ex.Should().BeAssignableTo <Exception>("because it is an exception");
        }