public async Task Should_Return_If_Control_Number_Is_Valid()
        {
            var to = new DateTime(2020, 02, 01);;

            var valNum = "421-2222-0";

            var item = Default.Entity
                       .SetProperty(x => x.Number, valNum)
                       .Value;

            var fakeDtp = new FakeDatetimeProvider
            {
                FakeNow = to
            };

            var fakeFactory = new FakeListQueryHandler();

            fakeFactory.QuerySource.Add(item);

            var query = GetQuery(fakeDtp, fakeFactory);

            var queryRequest = new GetAvailableEntityQuery();

            var result = await query.Handle(queryRequest);

            var number = Assert.Single(result.Entity);

            Assert.Equal(valNum, number.Number);
        }
        public async Task Should_Not_Return_If_Active_EntityExpirations_Exists()
        {
            var now  = new DateTime(2020, 02, 01);
            var to   = now.AddDays(1);
            var from = now.AddDays(-1);


            var valNum = "421-2222-0";

            var item = Default.Entity
                       .SetProperty(x => x.Number, valNum)
                       .WithSingleEntityExpiration(from, to)
                       .Value;


            var fakeDtp = new FakeDatetimeProvider
            {
                FakeNow = now
            };

            var fakeFactory = new FakeListQueryHandler();

            fakeFactory.QuerySource.Add(item);

            var query = GetQuery(fakeDtp, fakeFactory);

            var queryRequest = new GetAvailableEntityQuery();

            var result = await query.Handle(queryRequest);

            Assert.Empty(result.Entity);
        }
 private static GetAvailableEntityQueryHandler GetQuery(FakeDatetimeProvider fakeDtp, FakeListQueryHandler fakeQueryHandler) => new GetAvailableEntityQueryHandler(fakeDtp, fakeQueryHandler);