public override void When()
        {
            var generator = new UniqueRandomGenerator();
            var quizResults = Builder<QuizResult>.CreateListOfSize(10)
                .TheFirst(6)
                    .With(x => x.PartitionKey = TestValues.CARD_PARTITION_KEY)
                    .And(x => x.RowKey = CardRowTypes.CARD + "-" + generator.Next(1, 100))
                .TheLast(4)
                    .With(x => x.PartitionKey = TestValues.CARD_PARTITION_KEY)
                    .And(x => x.RowKey = CardRowTypes.QUIZ_RESULT + "-" + generator.Next(1, 100))
                .Build();

            this.TableStorageContext.Setup(x => x.CreateQuery<QuizResult>()).Returns(quizResults.AsQueryable());
            this.actualQuizResults = this.QuizResultsRepository.GetForUser();
        }
Beispiel #2
0
        public void CreateAdjudicaciones()
        {
            var generator = new UniqueRandomGenerator();

            AdjudicacionRepository adjudicacionRepository = new AdjudicacionRepository();

            var precios =
                Builder<Precio>.CreateListOfSize(100).All().WithConstructor(
                    () => new Precio("$", generator.Next(10, 100))).Build();

            var licitaciones = Builder<Licitacion>.CreateListOfSize(1)
                                .All()
                                    .With(x => x.Precio = precios.First())
                                .Build();

            var adjudicaciones = Builder<Adjudicacion>.CreateListOfSize(1)
                               .TheFirst(1)
                                   .With(x => x.Entidad = "UBA")
                                   .With(x => x.Licitaciones = licitaciones)
                               .Build();

            foreach (Adjudicacion adjudicacion in adjudicaciones)
            {
                adjudicacionRepository.Save(adjudicacion);
            }
        }
Beispiel #3
0
        public static IListBuilder <ProductService> GetDefaultExtrasServices()
        {
            var generator = new UniqueRandomGenerator();
            var mock      = Builder <ProductService>
                            .CreateListOfSize(10)
                            .All()
                            .With(item => item.Description           = Lorem.Paragraph(1))
                            .With(item => item.WaitingPeriodInMonths = generator.Next(1, 12))
                            .With(item => item.Name = Pick <string> .RandomItemFrom(new[]
            {
                "General Dental",
                "Major dental",
                "Orthodontics",
                "Optical",
                "Physiotherapy",
                "Chiropractic and osteopathy",
                "Antenatal and postnatal",
                "Natural Therapies",
                "Living Well Programs",
                "Pharmacy",
                "Dietary",
                "Psychology",
                "Podiatry",
                "Speech Therapy",
                "Eye Therapy",
                "Occupational Therapy",
                "Home Nursing",
                "Health aids and appliances",
                "Travel and accommodation expenses",
                "Emergency Ambulance Services",
                "Top Up Bonus",
                "Travel Well Benefits"
            }))
                            .With(
                item =>
                item.CoverType =
                    Pick <ProductServiceCoverType> .RandomItemFrom(new[]
            {
                ProductServiceCoverType.CoveredWithCondition,
                ProductServiceCoverType.FullyCovered,
                ProductServiceCoverType.MinimumBenefit,
                ProductServiceCoverType.NotCovered,
            }))
                            .With(
                item =>
                item.ProviderType =
                    Pick <ProductServiceProviderType> .RandomItemFrom(new[]
            {
                ProductServiceProviderType.AllProviders,
                ProductServiceProviderType.MemberFirst,
                ProductServiceProviderType.NonMembersFirst
            }))
                            .With(
                item =>
                item.Type = ProductServiceType.Extras)
                            .With(item => item.Limit = LimitBuilder.GetDefault().Build());

            return(mock);
        }
        public override void When()
        {
            var generator = new UniqueRandomGenerator();

            this.expectedCards = Builder<Card>
                .CreateListOfSize(10)
                .All().With(x => x.CreatedTimestamp = generator.Next(DateTime.MinValue, DateTime.MaxValue))
                .Build()
                .AsQueryable();

            this.TableStorageContext.Setup(x => x.Cards.GetForUser()).Returns(this.expectedCards);
            this.returnedCards = this.CardsController.Get();
        }
Beispiel #5
0
        public void HomePage_3()
        {
            var generator = new UniqueRandomGenerator();

            var products = Builder <Product> .CreateListOfSize(10)
                           .TheFirst(2)
                           .With(x => x.Title      = "special title 1")
                           .And(x => x.Description = "special description 1")
                           .TheNext(3)
                           .With(x => x.Title = "special title 2")
                           .TheNext(5)
                           .With(x => x.Title = "special title 3")
                           .And(x => x.Price  = generator.Next(0m, 10m))
                           .Build();
        }
        public override void When()
        {
            this.quizDate = new DateTime(TestValues.YEAR, TestValues.MONTH, TestValues.DAY);

            var dayBefore = this.quizDate.AddDays(-TestValues.DAY);
            var millisecondAfter = this.quizDate.AddMilliseconds(TestValues.DAY);
            var twelveHoursAfter = this.quizDate.AddHours(12);
            var dayAfter = this.quizDate.AddDays(TestValues.DAY);

            var generator = new UniqueRandomGenerator();

            // Use EntityId of >= 100 to indicate which cards should be included in result
            var userCards = Builder<Card>.CreateListOfSize(10)
                .All().With(x => x.CreatedTimestamp = generator.Next(DateTime.MinValue, DateTime.MaxValue))
                .TheFirst(2).With(x => x.QuizDate = dayBefore).And(x => x.EntityId = generator.Next(100, 1000))
                .TheNext(2).With(x => x.QuizDate = this.quizDate).And(x => x.EntityId = generator.Next(100, 1000))
                .TheNext(2).With(x => x.QuizDate = millisecondAfter).And(x => x.EntityId = generator.Next(100, 1000))
                .TheNext(2).With(x => x.QuizDate = twelveHoursAfter).And(x => x.EntityId = generator.Next(100, 1000))
                .TheNext(2).With(x => x.QuizDate = dayAfter)
                .Build();

            this.quizResultCards = Builder<Card>.CreateListOfSize(2)
                .All().With(x => x.EntityId = generator.Next(100, 1000))
                .Build();

            // Use IsCorrect = true to indicate which cards should be included in result
            this.quizResults = Builder<QuizResult>.CreateListOfSize(3).Build();

            this.TableStorageContext.Setup(x => x.Cards.GetForUser()).Returns(userCards.AsQueryable());
            this.TableStorageContext.Setup(x => x.Cards.GetForQuizResults(this.quizResults)).Returns(this.quizResultCards.AsQueryable());
            this.TableStorageContext.Setup(x => x.QuizResults.GetForQuiz(TestValues.YEAR, TestValues.MONTH, TestValues.DAY)).Returns(this.quizResults.AsQueryable());

            var userConfiguration = new UserConfiguration { UserId = TestValues.USER_ID };
            this.TableStorageContext.Setup(x => x.UserConfigurations.GetByNameIdentifier()).Returns(userConfiguration);
            this.cards = this.CardsController.GetForQuiz(TestValues.YEAR, TestValues.MONTH, TestValues.DAY);
        }
 private Resource CreateSampleResource()
 {
     return(Builder <Resource> .CreateNew().With(a => a.Id, _generator.Next(1, int.MaxValue).ToString()).Build());
 }
Beispiel #8
0
        public static IListBuilder <ProductService> GetDefaultHospitalServices()
        {
            var generator = new UniqueRandomGenerator();
            var mock      = Builder <ProductService>
                            .CreateListOfSize(10)
                            .All()
                            .With(item => item.Description           = Lorem.Paragraph(1))
                            .With(item => item.WaitingPeriodInMonths = generator.Next(1, 12))
                            .With(item => item.Name = Pick <string> .RandomItemFrom(new[]
            {
                "Accommodation for overnight and same day stays",
                "Operating theatre, intensive care, ward fees",
                "Bupa Medical Gap Scheme Available",
                "Surgically implanted prostheses",
                "Accidents sustained after joining",
                "Knee arthroscopy & meniscectomy procedures",
                "Appendicitis",
                "Removal of tonsils and adenoids",
                "Dental Surgery",
                "Minor gynaecological surgery",
                "Psychiatric services",
                "Rehabilitation services",
                "Pregnancy & birth related services including childbirth",
                "Assisted reproductive services (IVF)",
                "Cardiac & cardiac related services",
                "Renal dialysis for chronic renal failure",
                "Cataract & eye lens procedures",
                "Hip/knee replacement (including arthroplasty, revision and resurfacing procedures)",
                "All other joint replacements",
                "Gastric banding and all obesity related treatments",
                "All other in-patient treatments receiving a Medicare benefit",
                "Emergency Ambulance Services~",
                "Family and hospital benefits",
                "Health Subscription Refunds (contact us for details)",
                "Unemployment cover"
            }))
                            .With(
                item =>
                item.CoverType =
                    Pick <ProductServiceCoverType> .RandomItemFrom(new[]
            {
                ProductServiceCoverType.CoveredWithCondition,
                ProductServiceCoverType.FullyCovered,
                ProductServiceCoverType.MinimumBenefit,
                ProductServiceCoverType.NotCovered,
            }))
                            .With(
                item =>
                item.ProviderType =
                    Pick <ProductServiceProviderType> .RandomItemFrom(new[]
            {
                ProductServiceProviderType.AllProviders,
                ProductServiceProviderType.MemberFirst,
                ProductServiceProviderType.NonMembersFirst
            }))
                            .With(
                item =>
                item.Type = ProductServiceType.Hospital)
                            .With(item => item.Limit = LimitBuilder.GetDefault().Build());

            return(mock);
        }