Exemplo n.º 1
0
        public void SetOrderToUpdateIsProceededValueToTrue()
        {
            //Arrange
            var mockedOrderDataProvider    = new Mock <IEfAquaWorldDataProvider <Order> >();
            var mockedCreatureDataProvider = new Mock <IEfAquaWorldDataProvider <Creature> >();
            var orderId             = 5;
            var mockedOrderToUpdate = new Order()
            {
                Id = orderId, isProceeded = false
            };


            mockedOrderDataProvider.Setup(x => x.GetById(orderId)).Returns(mockedOrderToUpdate);

            //Act
            var actualOrderService = new AquaWorld.Data.Services.OrderService(
                mockedOrderDataProvider.Object,
                mockedCreatureDataProvider.Object,
                mockedOrderToUpdate);

            actualOrderService.ProceedOrderById(orderId);

            //Assert
            Assert.AreEqual(mockedOrderToUpdate.isProceeded, true);
        }
Exemplo n.º 2
0
        public void CallOrderDataProviderSaveChangesMethod()
        {
            //Arrange
            var mockedOrderDataProvider    = new Mock <IEfAquaWorldDataProvider <Order> >();
            var mockedCreatureDataProvider = new Mock <IEfAquaWorldDataProvider <Creature> >();
            var orderId             = 5;
            var mockedOrderToUpdate = new Order()
            {
                Id = orderId
            };


            mockedOrderDataProvider.Setup(x => x.GetById(orderId)).Returns(mockedOrderToUpdate);

            //Act
            var actualOrderService = new AquaWorld.Data.Services.OrderService(
                mockedOrderDataProvider.Object,
                mockedCreatureDataProvider.Object,
                mockedOrderToUpdate);

            actualOrderService.ProceedOrderById(orderId);

            //Assert
            mockedOrderDataProvider.Verify(x => x.SaveChanges(), Times.Once);
        }