public void IsEmpty_True() { Dictionary <string, string> syntax = new Dictionary <string, string>(); IName n = new CompoundName(string.Empty, syntax); Assert.IsTrue(n.IsEmpty()); }
public async Task <Unit> Handle(QuickAddCandidateCommand request, CancellationToken cancellationToken) { var user = _userAccessor.GetUser(); var job = await _context.JobPositions.FindAsync(request.JobPositionId); var entity = new Candidate(CompoundName.Create(request.FirstName, request.LastName).Value, job, ContactInfo.Create(request.PhoneNumber, request.Email).Value); var stage = await _context.RecruitmentStages.FindAsync(request.RecruitmentStageId); stage.AddCandidate(entity); _context.RecruitmentStages.Update(stage); await _context.SaveChangesAsync(cancellationToken); // Notifications var notification = new CandidateCreated { PrimaryEntityId = entity.Id, PrimaryEntityName = entity.Name.GetFullName, UserName = user.Identity.Name }; await _mediator.Publish(notification, cancellationToken); return(Unit.Value); }
public async Task <Unit> Handle(CreateCandidateCommand request, CancellationToken cancellationToken) { var user = _userAccessor.GetUser(); //TODO:Import the finder extension from Renson projects var job = await _context.JobPositions.FindAsync(request.JobPositionId); var stage = await _context.RecruitmentStages.FindAsync(request.RecruitmentStageId); var entity = new Candidate(CompoundName.Create(request.FirstName, request.LastName).Value, job, ContactInfo.Create(request.PhoneNumber, request.Email).Value); var operation = stage.AddCandidate(entity); if (operation.IsFailure) { throw new InvalidOperationException(operation.Error); } _context.RecruitmentStages.Update(stage); await _context.SaveChangesAsync(cancellationToken); // Notifications var notification = new CandidateCreated { PrimaryEntityId = entity.Id, UserName = user.Identity.Name }; await _mediator.Publish(notification, cancellationToken); return(Unit.Value); }
public NamedTypeLiteral(CompoundName name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } this.Name = name; }
/// <summary> /// Химическое соединение /// </summary> /// <param name="name">Наименование</param> /// <param name="molecularMass">Молекулярная масса</param> /// <param name="criticalPressure">Критическое давление (МПа)</param> /// <param name="criticalTemperature">Критическая температура (К)</param> /// <param name="densityAtStandardConditions">Плотность в стандартных условиях (кг/м3)</param> private ChemicalCompound(CompoundName name, double molecularMass, double criticalPressure, double criticalTemperature, double densityAtStandardConditions) { Name = name; CriticalPressure = criticalPressure; CriticalTemperature = criticalTemperature; MolecularMass = molecularMass; DensityAtStandardConditions = densityAtStandardConditions; }
public void IsEmpty_False() { Dictionary <string, string> syntax = new Dictionary <string, string>(); IName n = new CompoundName(string.Empty, syntax); n.Add("item1"); Assert.IsFalse(n.IsEmpty()); }
public void Get_Success() { Dictionary <string, string> syntax = new Dictionary <string, string>(); IName n = new CompoundName(string.Empty, syntax); n.Add("item1"); n.Add("item2"); n.Add("item3"); Assert.AreSame("item2", n.Get(1)); }
public void EndsWithName_Fail() { Dictionary <string, string> syntax = new Dictionary <string, string>(); IName nEnd = new CompoundName("item1", syntax); IName n = new CompoundName(string.Empty, syntax); n.Add("item1"); n.Add("item2"); Assert.IsFalse(n.EndsWith(nEnd)); }
/// <summary> /// Change the name of the contact /// </summary> /// <param name="newName"></param> /// <param name="modifiedBy"></param> /// <returns></returns> public Result UpdateContactName(CompoundName newName, Guid modifiedBy) { if (Name.Equals(newName)) { return(Result.Fail("Name is identical")); } Name = newName; return(Result.Ok()); }
/// <summary> /// Constructor. /// </summary> /// <param name="contactInfo"></param> /// <param name="organizationId"></param> /// <param name="name"></param> /// <param name="id"></param> /// <param name="createdBy"></param> public ClientContact(ContactInfo contactInfo, Guid organizationId, CompoundName name, Guid id, Guid createdBy) { if (organizationId == Guid.Empty) { throw new ArgumentException("Organization Id must be specified"); } ContactInfo = contactInfo; Name = name; CreateEnd(id, name.ToString(), createdBy); }
public void InsertStringAtPosition_ok() { Dictionary <string, string> syntax = new Dictionary <string, string>(); IName n = new CompoundName(string.Empty, syntax); n.Insert(0, "item1"); IEnumerable <string> r = n.GetAll(); IEnumerator <string> enumerator = r.GetEnumerator(); enumerator.MoveNext(); Assert.AreSame("item1", enumerator.Current); Assert.IsFalse(enumerator.MoveNext()); }
public override bool MatchFilter(string filter) { string ucfilter = filter.ToUpper(); string ucname = CompoundName.ToUpper(); if (base.MatchFilter(filter) == true) { return(true); } else if (ucname.Contains(ucfilter)) { return(true); } else { return(false); } }
public void DivideNameWithSpacesBySeparator_DonotTrim_FoundCoupleNameComponents() { Dictionary <string, string> syntax = new Dictionary <string, string>() { { "separator", ";" } }; IName n = new CompoundName("itemA ; itemB; itemC ", syntax); IEnumerable <string> r = n.GetAll(); IEnumerator <string> enumerator = r.GetEnumerator(); enumerator.MoveNext(); Assert.AreEqual("itemA ", enumerator.Current); enumerator.MoveNext(); Assert.AreEqual(" itemB", enumerator.Current); enumerator.MoveNext(); Assert.AreEqual(" itemC ", enumerator.Current); Assert.IsFalse(enumerator.MoveNext()); }
public CompilerError UnknownImport(CompoundName name) => Add($"Could not find module {name} for import.");
/// <summary> /// Create a candidate and fill in the basic required information. /// </summary> /// <param name="name"></param> /// <param name="jobPosition"></param> /// <param name="contactInfo"></param> public Candidate(CompoundName name, JobPosition jobPosition, ContactInfo contactInfo) { Name = name; JobPosition = jobPosition; ContactInfo = contactInfo; }
public Module Add(CompoundName value) { this.Imports.Add(value); return(this); }
public void CreateName_ok() { Dictionary <string, string> syntax = new Dictionary <string, string>(); IName n = new CompoundName(string.Empty, syntax); }