Ejemplo n.º 1
0
        public void and_no_password_THEN_result_is_insufficient_parameters()
        {
            var subject = new UserRegistrationService();
            var userRequest = new BuildUserRequest()
                .WithPassword("");

            var result = subject.RegisterUser(userRequest);

            result.Should().BeOfType<TooFewDataPassed>();
        }
Ejemplo n.º 2
0
        public void and_user_has_less_than_16_years_THEN_result_is_user_too_young()
        {
            var subject = new UserRegistrationService();
            var userData = new BuildUserRequest()
                .WithBirthDate("2010-10-01");

            var result = subject.RegisterUser(userData);

            result.Should().BeOfType<UserIsTooYoung>();

        }
Ejemplo n.º 3
0
        public void THEN_user_has_been_added()
        {
            UserAccountRequest userRequest = new BuildUserRequest().WithPhoneNumber("123456789");
            var subject = new UserRegistrationService();

            subject.RegisterUser(userRequest);

            subject.Users.Should().Contain(user => user.PhoneNumber == "123456789");

            Console.WriteLine(userRequest);
        }
Ejemplo n.º 4
0
        public void THEN_we_can_do_many_things_with_fluent_assertions()
        {
            var subject = new UserRegistrationService();
            var userData = new BuildUserRequest()
                .WithBirthDate("2010-10-01");

            var result = subject.RegisterUser(userData);

            subject.Invoking(x => x.RegisterUser(null)).ShouldThrow<NullReferenceException>();

            subject.ExecutionTimeOf(x => x.RegisterUser(userData)).ShouldNotExceed(new TimeSpan(0, 0, 1));
        }