Exemplo n.º 1
0
        public void PayReservation_UserCanPaidReservation_ThrowsNotImplemented()
        {
            var userComplex        = new UserComplex();
            var reservationComplex = new ReservationComplex();

            userComplex.Money = 100;

            Assert.Throws <NotImplementedException>(() => reservationComplex.PayReservation(userComplex));
        }
Exemplo n.º 2
0
        public void PayReservation_userIsNull_null()
        {
            //Arrange
            var userReservationComplex = new UserComplex();

            var reservationComplex = new ReservationComplex();

            //Act
            var result = reservationComplex.PayReservation(userReservationComplex);

            //Assert
            Assert.That(result, Is.Null);
        }
        public void CanBeCancelledBy_UserIsMadeBy_ReturnsTrue()
        {
            //Arrange
            var persona     = new UserComplex();
            var reservation = new ReservationComplex {
                MadeBy = persona
            };

            //Act
            var result = reservation.CanBeCancelledBy(persona);

            //Assert
            Assert.That(result, Is.True);
        }
Exemplo n.º 4
0
        public void user_cant_pay_reservation_return_1()
        {
            var user = new UserComplex
            {
                Money   = 200,
                IsAdmin = false
            };

            var reservation = new ReservationComplex
            {
                Price = 500
            };

            Assert.That(reservation.PayReservation(user), Is.EqualTo(1));
        }
Exemplo n.º 5
0
        public void ReservationComplex_MoneySmallerThanPrice_ReturnsZero()
        {
            //Arrange
            var reservationComplex = new ReservationComplex()
            {
                Price = 500
            };
            var paco = new UserComplex()
            {
                Money = 200
            };

            //Act
            //Assert
            Assert.Throws <ArgumentOutOfRangeException>(() => reservationComplex.PayReservation(paco));
        }
Exemplo n.º 6
0
        public void PayReservation_UserThereIsEqualMoney_Returns0()
        {
            //Arrange
            var userReservationComplex = new UserComplex();

            userReservationComplex.Money = 200;

            var reservationComplex = new ReservationComplex();

            reservationComplex.Price = 200;

            //Act
            var result = reservationComplex.PayReservation(userReservationComplex);

            //Assert
            Assert.That(result, Is.GreaterThanOrEqualTo(0));
        }
Exemplo n.º 7
0
        public void PayReservation_UserThereIsNoMoney_ReturnsDifferenceMoney()
        {
            //Arrange
            var userReservationComplex = new UserComplex();

            userReservationComplex.Money = 100;

            var reservationComplex = new ReservationComplex();

            reservationComplex.Price = 200;

            //Act
            var result = reservationComplex.PayReservation(userReservationComplex);

            //Assert
            Assert.That(result, Is.GreaterThan(0));
        }
Exemplo n.º 8
0
        public void PayReservation_UserThereIsMoney_Returns0()
        {
            //Arrange
            var userReservationComplex = new UserComplex();

            userReservationComplex.Money = 300;

            var reservationComplex = new ReservationComplex();

            reservationComplex.Price = 200;

            //Act
            var result = reservationComplex.PayReservation(userReservationComplex);

            //Assert
            Assert.That(result, Is.Zero);
        }
        public void MoneyUser_IsLowerPrice_Returns0()
        {
            //Arrange
            var persona = new UserComplex()
            {
                IsAdmin = false, Money = 20
            };
            var reservation = new ReservationComplex()
            {
                MadeBy = persona, Price = 30
            };

            //Act
            var result = reservation.PayReservation(persona);

            //Assert
            Assert.AreEqual(result, 1);
        }
        public void MoneyUser_IsHigherPrice_ReturnsResultOperation()
        {
            //Arrange
            var persona = new UserComplex()
            {
                IsAdmin = false, Money = 50
            };
            var reservation = new ReservationComplex()
            {
                MadeBy = persona, Price = 30
            };

            //Act
            var result = reservation.PayReservation(persona);

            //Assert
            Assert.AreEqual(persona.Money, 20);
        }
Exemplo n.º 11
0
        public void ReservationComplex_MoneyEqualThanPrice_ReturnsZero()
        {
            //Arrange
            var reservationComplex = new ReservationComplex()
            {
                Price = 1000
            };
            var paco = new UserComplex()
            {
                Money = 1000
            };

            //Act
            var result = reservationComplex.PayReservation(paco);

            //Assert
            Assert.AreEqual(result, 0);
        }
Exemplo n.º 12
0
        public void user_pay_reservation_and_reduce_his_money()
        {
            var user = new UserComplex
            {
                Money   = 200,
                IsAdmin = false
            };

            var reservation = new ReservationComplex
            {
                Price = 50
            };

            var mainMoney = user.Money;


            reservation.PayReservation(user);

            Assert.That(user.Money, Is.EqualTo(mainMoney - reservation.Price));
        }
Exemplo n.º 13
0
 public EmptyResult UserInsert(UserComplex userComplex)
 {
     return(new EmptyResult());
 }