Пример #1
0
        public void Should_Be_Able_To_Update_The_Price_Of_A_Call()
        {
            var data = CallViewModelFaker.GenerateCallViewModel();

            var call = CallFaker.GenerateCall(data);

            call.PricePerMinute = 4.30m;

            var updatedCall = call;

            updatedCall.PricePerMinute = data.PricePerMinute;

            var updatedCallViewModel = data;

            updatedCallViewModel.PricePerMinute = updatedCall.PricePerMinute;

            callsRepository.Setup(x =>
                                  x.FindByFromToAreaCode(data.FromAreaCode, data.ToAreaCode)
                                  ).Returns(call);
            callsRepository.Setup(x => x.SaveChanges());
            mapper.Setup(x => x.Map <CallViewModel>(updatedCall))
            .Returns(updatedCallViewModel);

            var response = callServices.UpdateCallPrice(data);

            Assert.NotNull(response);
        }
Пример #2
0
        public void Should_Not_Return_A_Call_Price()
        {
            var call = CallFaker.GenerateCall();

            var fromAreaCode = call.FromAreaCode;
            var toAreaCode   = call.ToAreaCode;

            callsRepository.Setup(x => x.FindByFromToAreaCode(fromAreaCode, toAreaCode))
            .Returns((Call)null);

            Assert.Throws <FaleMaisException>(
                () => callServices.GetCallPriceFromTo(fromAreaCode, toAreaCode)
                );
        }
Пример #3
0
        public void Should_Return_A_Call_Price()
        {
            var call = CallFaker.GenerateCall();

            var callViewModel = CallViewModelFaker.GenerateCallViewModel(call);

            var fromAreaCode = call.FromAreaCode;
            var toAreaCode   = call.ToAreaCode;

            callsRepository.Setup(x => x.FindByFromToAreaCode(fromAreaCode, toAreaCode))
            .Returns(call);
            mapper.Setup(x => x.Map <CallViewModel>(call)).Returns(callViewModel);

            var response = callServices.GetCallPriceFromTo(fromAreaCode, toAreaCode);

            Assert.NotNull(response);
        }