public void PayReservation_UserCanPaidReservation_ThrowsNotImplemented()
        {
            var userComplex        = new UserComplex();
            var reservationComplex = new ReservationComplex();

            userComplex.Money = 100;

            Assert.Throws <NotImplementedException>(() => reservationComplex.PayReservation(userComplex));
        }
示例#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);
        }
示例#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));
        }
示例#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));
        }
示例#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));
        }
示例#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));
        }
示例#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);
        }
示例#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);
        }
示例#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));
        }
示例#13
0
 public EmptyResult UserInsert(UserComplex userComplex)
 {
     return(new EmptyResult());
 }