Example #1
0
            public void ReturnNewCeases()
            {
                var mobileBuilder = new MobileBuilder();
                var newCease1     = mobileBuilder
                                    .WithMobileState(Mobile.MobileState.ProcessingCease)
                                    .WithOrderType(Order.OrderType.Cease)
                                    .WithOrderState(Order.State.New)
                                    .Build();
                var newProvision1 = mobileBuilder
                                    .WithMobileState(Mobile.MobileState.New)
                                    .WithOrderType(Order.OrderType.Provision)
                                    .WithOrderState(Order.State.New)
                                    .Build();
                var newCease2 = mobileBuilder
                                .WithMobileState(Mobile.MobileState.ProcessingCease)
                                .WithOrderType(Order.OrderType.Cease)
                                .WithOrderState(Order.State.New)
                                .Build();

                fixture.DataAccess.Add(newCease1);
                fixture.DataAccess.Add(newProvision1);
                fixture.DataAccess.Add(newCease2);
                using var context = new MobilesContext(fixture.ContextOptions);
                var sut = new GetNewCeasesQuery(context, new DateTimeCreator());

                var actual = sut.Get().ToList();

                actual.ElementAt(0).Should().BeEquivalentTo(newCease1);
                actual.ElementAt(1).Should().BeEquivalentTo(newCease2);
                actual.Count.Should().Be(2);
            }
Example #2
0
            public void ReturnMobile()
            {
                var mobileBuilder  = new MobileBuilder();
                var expectedMobile = mobileBuilder
                                     .WithMobileState(Mobile.MobileState.New)
                                     .BuildWithoutOrder();

                mobiles.Add(expectedMobile);
                using var context = new MobilesContext(fixture.ContextOptions);
                sut = new MobileRepository(context, new EnumConverter(), new DateTimeCreator());
                sut.Add(expectedMobile);

                var actual = sut.GetById(expectedMobile.GlobalId);

                actual.Should().BeEquivalentTo(expectedMobile);
            }
            public void ReturnMobile()
            {
                var mobileBuilder  = new MobileBuilder();
                var expectedMobile = mobileBuilder
                                     .WithMobileState(Mobile.MobileState.New)
                                     .WithOrderType(Order.OrderType.Provision)
                                     .WithOrderState(Order.State.New)
                                     .Build();

                fixture.DataAccess.Add(expectedMobile);
                using var context = new MobilesContext(fixture.ContextOptions);
                var sut = new GetMobileByOrderIdQuery(context, new DateTimeCreator());

                var actual = sut.Get(expectedMobile.Orders.First().GlobalId);

                actual.Should().BeEquivalentTo(expectedMobile);
            }
Example #4
0
            public void ReturnNextMobileId()
            {
                var mobileBuilder = new MobileBuilder();
                var mobile        = mobileBuilder
                                    .WithMobileState(Mobile.MobileState.Live)
                                    .WithOrderType(Order.OrderType.Activate)
                                    .WithOrderState(Order.State.Completed)
                                    .Build();

                fixture.DataAccess.Add(mobile);
                using var context = new MobilesContext(fixture.ContextOptions);
                var sut = new GetNextMobileIdQuery(context);

                var actual = sut.Get();

                actual.Should().Be(mobile.Id + 1);
            }
Example #5
0
            public void AddMobile()
            {
                var mobileBuilder = new MobileBuilder();

                expectedMobile = mobileBuilder
                                 .WithMobileState(Mobile.MobileState.New)
                                 .BuildWithoutOrder();
                using var context = new MobilesContext(fixture.ContextOptions);
                sut = new MobileRepository(context, new EnumConverter(), new DateTimeCreator());
                sut.Add(expectedMobile);

                expectedMobile.Provision();
                sut.Update(expectedMobile);

                var actual = sut.GetById(expectedMobile.GlobalId);

                actual.State.Should().Be(Mobile.MobileState.ProcessingProvision);
            }
Example #6
0
            public void AddMobile()
            {
                var mobileBuilder = new MobileBuilder();

                expectedMobile = mobileBuilder
                                 .WithMobileState(Mobile.MobileState.Live)
                                 .WithOrderType(Order.OrderType.Activate)
                                 .WithOrderState(Order.State.Completed)
                                 .Build();
                using var context = new MobilesContext(fixture.ContextOptions);
                sut = new MobileRepository(context, new EnumConverter(), new DateTimeCreator());

                sut.Add(expectedMobile);

                var actual = sut.GetById(expectedMobile.GlobalId);

                actual.Should().BeEquivalentTo(expectedMobile);
            }