public void WhenUsingChildListBuilderWithoutModifier_ThenAListOfDefaultChildrenObjectsGetCreated() { var parent = new ParentBuilder() .WithChildrenBuilder(4) .Build(); parent.Children.Count.ShouldBe(4); }
/// <devdoc> /// Gets the inner text of the property. /// </devdoc> public override void AppendLiteralString(string s) { if (ParentBuilder != null && ParentBuilder.HtmlDecodeLiterals()) { s = HttpUtility.HtmlDecode(s); } _text = s; }
public void WhenUsingChildBuilderIncludingModifier_ThenTheModifierGetsApplied() { const int number = 2; var parent = new ParentBuilder() .WithChildBuilder(b => b.WithANumber(number)) .Build(); parent.Child.Number.ShouldBe(number); }
public CoverageMockBuilder WithAssembly(string assemblyName) { _currentAssembly.Types.AddRange(Types); if (!_currentTypeAlreadyAdded) { _currentAssembly.Types.Add(_currentType); } return(ParentBuilder.WithAssembly(assemblyName)); }
public void ParentBuild_GeneratesSomeChildren() { dynamic parentBuilder = new ParentBuilder(); var parent = parentBuilder .Build(); Assert.IsNotNull(parent); Assert.IsNotNull(parent.Children); Assert.IsTrue(parent.Children.Count > 0); }
public void WhenUsingChildListBuilderIncludingModifier_ThenTheModifierGetsApplied() { const int number = 2; var parent = new ParentBuilder() .WithChildrenBuilder(4, b => b.All().WithANumber(number)) .Build(); parent.Children.Count.ShouldBe(4); parent.Children.ForEach((x) => x.Number.ShouldBe(2)); }
protected virtual void FireOnDeclarePlaceHolder(AbstractBuilder builder = null) { if (OnDeclarePlaceHolder != null) { OnDeclarePlaceHolder(this, builder ?? this); } if (ParentBuilder != null) { ParentBuilder.FireOnDeclarePlaceHolder(builder ?? this); } }
protected virtual void FireOnPreCreateTags(AbstractBuilder builder = null) { if (OnPreCreateTags != null) { OnPreCreateTags(this, builder ?? this); } if (ParentBuilder != null) { ParentBuilder.FireOnPreCreateTags(builder ?? this); } }
public void ParentBuildUntilChild_LeavesChildrenEmpty() { dynamic parentBuilder = new ParentBuilder(); var parent = parentBuilder .Until(typeof (ChildModel)) .Build(); Assert.IsNotNull(parent); Assert.IsNotNull(parent.Children); Assert.IsTrue(parent.Children.Count == 0); }
/// <summary> /// Genera el elemento /// </summary> public ProjectItemDefinitionModel Build() { if (ParentBuilder != null) { return(ParentBuilder.Build()); } else { return(Item); } }
public void ParentFlatBuild_LeavesChildrenEmpty() { dynamic parentBuilder = new ParentBuilder(); var parent = parentBuilder .Flat() .Build(); Assert.IsNotNull(parent); Assert.IsNotNull(parent.Children); Assert.IsTrue(parent.Children.Count == 0); }
protected virtual void FireOnPostRender(AbstractBuilder builder = null) { if (OnPostRender != null) { OnPostRender(this, builder ?? this); } if (ParentBuilder != null) { ParentBuilder.FireOnPostRender(builder ?? this); } }
protected virtual void FireOnCreateBuilder(AbstractBuilder builder) { if (OnCreateBuilder != null) { OnCreateBuilder(this, builder); } if (ParentBuilder != null) { ParentBuilder.FireOnCreateBuilder(builder); } }
public void WithRandomProps_ShouldReuseKnownBuildersFromSameAssemblyAsType() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var result = ParentBuilder.BuildRandom(); //---------------Test Result ----------------------- Assert.AreEqual(1337, result.Child.Id); }
public bool CreateBuilder() { if (ParentBuilder != null && !ParentBuilder.IsCreateOk) { ParentBuilder.CreateBuilder(); } if (!isok && ParentBuilder.IsCreateOk) { isok = CreateDatum(); } return(isok); }
public void ShouldMakeNewParentAddressIfNoneExists() { var source = new EditableParentAddressModelBuilder().WithAddress("123 Model Rd").Build(); var target = new ParentBuilder().Build(); var mapper = new EditableParentAddressModelToParentMapper(); mapper.Map(source, target); target.ParentAddresses.First().StreetNumberName.ShouldBe(source.Address); target.ParentAddresses.First().ApartmentRoomSuiteNumber.ShouldBe(source.Address2); target.ParentAddresses.First().City.ShouldBe(source.City); target.ParentAddresses.First().PostalCode.ShouldBe(source.PostalCode); target.ParentAddresses.First().StateAbbreviationTypeId.ShouldBe((int)source.State); }
public void ShouldMapStudentToProfileModelWithDifferentParentAddress() { SetupWithDownloaderReturning(""); var parent = new ParentBuilder().WithAddress().WithPhoneNumber().Build(); var student = new StudentBuilder().WithParent(parent, false).Build(); var profileModel = new ProfileModel(); _mapper.Map(student, profileModel); NativeStudentPropertiesShouldBeMapped(student, profileModel); NativeParentPropertiesShouldBeMapped(parent, profileModel.EditProfileParentModel); ParentAddressShouldBeMapped(parent, profileModel); StudentParentAssociationShouldBeMapped(student, profileModel); }
public void ShouldNotCreateEmailIfNoEmailExistedButBlankEmailInEditProfileModel() { var entity = new ParentBuilder().WithPhoneNumber().Build(); entity.StudentParentAssociations.Add(new StudentParentAssociation()); var model = new EditProfileParentModelBuilder().WithBlankEmail().Build(); var mapper = new EditProfileParentModelToParentMapper(new EditableParentAddressModelToParentMapper()); mapper.Map(model, entity); entity.FirstName.ShouldBe(model.FirstName); entity.LastSurname.ShouldBe(model.LastName); entity.ParentElectronicMails.ShouldBeEmpty(); entity.ParentTelephones.First().TelephoneNumber.ShouldBe(model.TelephoneNumber); entity.ParentTelephones.First().TelephoneNumberTypeId.ShouldBe((int)TelephoneNumberTypeEnum.Emergency1); entity.SexTypeId.ShouldBe((int)model.Sex); }
public void ShouldMap() { var entity = new ParentBuilder().WithEmail().WithPhoneNumber().Build(); entity.StudentParentAssociations.Add(new StudentParentAssociation()); var model = new EditProfileParentModelBuilder().Build(); var mapper = new EditProfileParentModelToParentMapper(new EditableParentAddressModelToParentMapper()); mapper.Map(model, entity); entity.FirstName.ShouldBe(model.FirstName); entity.LastSurname.ShouldBe(model.LastName); entity.ParentElectronicMails.First().ElectronicMailAddress.ShouldBe(model.EmailAddress); entity.ParentElectronicMails.First().ElectronicMailTypeId.ShouldBe((int)ElectronicMailTypeEnum.HomePersonal); entity.ParentTelephones.First().TelephoneNumber.ShouldBe(model.TelephoneNumber); entity.ParentTelephones.First().TelephoneNumberTypeId.ShouldBe((int)TelephoneNumberTypeEnum.Emergency1); entity.SexTypeId.ShouldBe((int)model.Sex); }
public void ParentBuildWithChildren_UsesSpecifiedChildrenInsteadOfGenerating() { var children = new List<ChildModel>(); for (var i = 0; i < 20; ++i) // Cannot generate 20 children { children.Add(new ChildBuilder() .Build()); } dynamic parentBuilder = new ParentBuilder(); var parent = parentBuilder .WithChildren(children) .Build(); Assert.IsNotNull(parent); Assert.IsNotNull(parent.Children); Assert.IsTrue(parent.Children.Count == 20); }
public bool CreateBuilder() { if (ParentBuilder != null) { if (!ParentBuilder.IsCreateOk) { ParentBuilder.CreateBuilder(); } if (!isok && ParentBuilder.IsCreateOk) { isok = CreatWave(); } } if (!isok) { isok = CreatWave(); } return(isok); }
public void GetByUSIShouldReturnFirstMatchingParentWithDependencies() { var mockDbContext = new Mock <INglDbContext>(); var repo = new ParentRepository(mockDbContext.Object); const int parentUSI = 3; var parentBuilder = new ParentBuilder(); var parents = new List <Parent> { parentBuilder.WithUSI(1).Build(), parentBuilder.WithUSI(parentUSI).Build(), parentBuilder.WithUSI(2).Build() }.AsQueryable(); var mockSet = new Mock <IDbSet <Parent> >(); mockSet.As <IQueryable <Parent> >().Setup(m => m.Provider).Returns(parents.Provider); mockSet.As <IQueryable <Parent> >().Setup(m => m.Expression).Returns(parents.Expression); mockDbContext.Setup(dbContext => dbContext.Set <Parent>()).Returns(mockSet.Object); var returnedParent = repo.GetByUSI(parentUSI); Assert.Equal(parentUSI, returnedParent.ParentUSI); }
public void ParentBuild_GeneratesChildrenWithMultiplier() { const int multiplier = 4; dynamic parentBuilder = new ParentBuilder(); var parent = parentBuilder .WithRangeMultiplier(multiplier) .IsResponsible(true) .Build(); Assert.IsNotNull(parent); Assert.IsNotNull(parent.Children); Assert.IsTrue(parent.Children.Count > 0); foreach (var child in parent.Children) { Assert.IsTrue(child.Minimum >= multiplier * 4); Assert.IsTrue(child.Maximum > child.Minimum); } }
public CoverageResult Mock() { return(ParentBuilder.Mock()); }
public SwitchSortOperationBuilder <TRequest, TEntity, TValue> ForCase(TValue value) => ParentBuilder.ForCase(value);
public SwitchSortOperationBuilder <TRequest, TEntity, TValue> ForDefaultCase() => ParentBuilder.ForDefaultCase();
public void WhenUsingChildBuilder_ThenTheAnonymousValueFixtureIsReused() { var parent = new ParentBuilder().WithChildBuilder().Build(); parent.ParentEnum.ShouldNotBe(parent.Child.ChildEnum); }