예제 #1
0
        public void WaitingForActivateToLiveScenario()
        {
            var dateTimeCreatorMock = new Mock <IDateTimeCreator>();

            var sut = new Mobile(dateTimeCreatorMock.Object, new MobileDataEntity
            {
                Id = 101, GlobalId = Guid.NewGuid(), State = Mobile.MobileState.WaitingForActivate.ToString()
            });

            var activateOrder = new Order(new OrderDataEntity {
                GlobalId = Guid.NewGuid(), Name = "Name", ContactPhoneNumber = "0123456789", State = "New"
            });

            sut.Activate(activateOrder);

            sut.State.Should().Be(Mobile.MobileState.ProcessingActivate);
            sut.InProgressOrder.CurrentState.Should().Be(Api.Domain.Order.State.New);

            sut.OrderProcessing();

            sut.InProgressOrder.CurrentState.Should().Be(Api.Domain.Order.State.Processing);

            sut.OrderSent();

            sut.InProgressOrder.CurrentState.Should().Be(Api.Domain.Order.State.Sent);

            sut.ActivateCompleted();

            sut.State.Should().Be(Mobile.MobileState.Live);
            sut.InProgressOrder.Should().BeNull();
            sut.Orders.First().CurrentState.Should().Be(Api.Domain.Order.State.Completed);
        }
예제 #2
0
            public ActivateCompletedShould()
            {
                var dateTimeCreatorMock = new Mock <IDateTimeCreator>();

                var mobileOrder = new Order(new OrderDataEntity {
                    GlobalId = Guid.NewGuid(), Name = "Name", ContactPhoneNumber = "0123456789", State = "Sent"
                });

                sut = new Mobile(dateTimeCreatorMock.Object,
                                 new MobileDataEntity
                {
                    Id       = 101,
                    GlobalId = Guid.NewGuid(),
                    State    = Mobile.MobileState.ProcessingActivate.ToString(),
                    Orders   = new List <OrderDataEntity>()
                    {
                        mobileOrder.GetDataEntity()
                    }
                });

                sut.ActivateCompleted();
            }