Ejemplo n.º 1
0
            public void ReturnNewProvisions()
            {
                var newProvision1 = mobileBuilder
                                    .WithMobileState(Mobile.MobileState.New)
                                    .WithOrderType(Order.OrderType.Provision)
                                    .WithOrderState(Order.State.New)
                                    .Build();
                var newProvision2 = mobileBuilder
                                    .WithMobileState(Mobile.MobileState.New)
                                    .WithOrderType(Order.OrderType.Provision)
                                    .WithOrderState(Order.State.New)
                                    .Build();
                var newProvision3 = mobileBuilder
                                    .WithMobileState(Mobile.MobileState.New)
                                    .WithOrderType(Order.OrderType.Provision)
                                    .WithOrderState(Order.State.New)
                                    .Build();

                fixture.DataAccess.Add(newProvision1);
                fixture.DataAccess.Add(newProvision2);
                fixture.DataAccess.Add(newProvision3);
                using var context = new MobilesContext(fixture.ContextOptions);
                var sut = new GetNewProvisionsQuery(context, new DateTimeCreator());

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

                actual.ElementAt(0).Should().BeEquivalentTo(newProvision1);
                actual.ElementAt(1).Should().BeEquivalentTo(newProvision2);
                actual.ElementAt(2).Should().BeEquivalentTo(newProvision3);
            }
Ejemplo n.º 2
0
            public void ReturnEmpty_WhenNoMobiles()
            {
                using var context = new MobilesContext(fixture.ContextOptions);
                var sut = new GetNewProvisionsQuery(context, new DateTimeCreator());

                var actual = sut.Get();

                actual.Should().BeEmpty();
            }
Ejemplo n.º 3
0
            public void DoesNotReturnMobilesWhichHaveNoOrders()
            {
                var newProvision1 = mobileBuilder
                                    .WithMobileState(Mobile.MobileState.New)
                                    .BuildWithoutOrder();

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

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

                actual.Should().BeEmpty();
            }
Ejemplo n.º 4
0
            public void DoesNotReturnMobilesWhichAreNotNew(string stateString)
            {
                var state         = new EnumConverter().ToEnum <Mobile.MobileState>(stateString);
                var newProvision1 = mobileBuilder
                                    .WithMobileState(state)
                                    .WithOrderType(Order.OrderType.Provision)
                                    .WithOrderState(Order.State.New)
                                    .Build();

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

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

                actual.Should().BeEmpty();
            }