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); } }
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(); }
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(); }
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); }
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); }