public void TestCreateGetParticipantDTOByIdQuery() { var status = new ParticipantStatus { ParticipantStatusId = 1, Status = "status", }; var person = new Person { PersonId = 1, FullName = "firstName lastName" }; var history = new History { RevisedOn = DateTimeOffset.Now }; var participantType = new ParticipantType { ParticipantTypeId = ParticipantType.Individual.Id, Name = "name", IsPerson = true }; var participant = new Participant { ParticipantId = 1, PersonId = person.PersonId, Person = person, ParticipantType = participantType, ParticipantTypeId = participantType.ParticipantTypeId, History = history, Status = status, ParticipantStatusId = status.ParticipantStatusId }; participant.Status = status; status.Participants.Add(participant); context.ParticipantStatuses.Add(status); context.People.Add(person); context.ParticipantTypes.Add(participantType); context.Participants.Add(participant); var results = ParticipantQueries.CreateGetParticipantDTOByIdQuery(context, participant.ParticipantId); Assert.AreEqual(1, results.Count()); var result = results.First(); Assert.AreEqual(participant.ParticipantId, result.ParticipantId); Assert.AreEqual(participant.PersonId, result.PersonId); Assert.IsNull(participant.OrganizationId); Assert.AreEqual(participant.ParticipantTypeId, result.ParticipantTypeId); Assert.AreEqual(participant.ParticipantType.Name, result.ParticipantType); Assert.AreEqual(person.FullName, result.Name); Assert.AreEqual(status.Status, result.ParticipantStatus); Assert.AreEqual(status.ParticipantStatusId, result.StatusId); Assert.AreEqual(history.RevisedOn, result.RevisedOn); Assert.AreEqual(participantType.IsPerson, result.IsPersonParticipantType); }
// send remote data if we can private bool SaveRemotely(string dataString) { bool saved = false; if (webClientValid == WebClientState.FAILED) { return(false); } try { if (!loggedin) { Login(); } long participant = ParticipantStatus.GetInstance().GetParticipant(); if (loggedin && participant >= 0) { // check if we succeeded and retry a limited number of times with backoff if we don't int tries = SAVE_RETRIES; do { saved = false; string uri = string.Format("{0}/save/{1}", REMOTE_URI, participant); string result = PostRequest(uri, dataString); if (result == null) { break; } Debug.Log("save result: " + result); if (result.StartsWith("OK")) { Debug.Log("confirmed save"); saved = true; } else { tries--; if (tries <= 0) { break; } Debug.Log("failed trying to log in again " + tries + " tries left"); Thread.Sleep(SAVE_RETRIES - tries * 500); // ms to wait before trying again Login(); } } while (loggedin && !saved); if (!saved) { Debug.Log("ERROR: NOT ABLE TO SAVE DATA REMOTELY!"); } } } catch (Exception e) { Debug.Log(e.Message); } return(saved); }
public async Task TestGet_CheckProperties() { var participantStatus = new ParticipantStatus { Status = ParticipantStatus.Active.Value, ParticipantStatusId = ParticipantStatus.Active.Id, }; context.ParticipantStatuses.Add(participantStatus); Action <PagedQueryResults <ParticipantStatusDTO> > tester = (results) => { Assert.AreEqual(1, results.Total); Assert.AreEqual(1, results.Results.Count); var firstResult = results.Results.First(); Assert.AreEqual(participantStatus.ParticipantStatusId, firstResult.Id); Assert.AreEqual(participantStatus.Status, firstResult.Name); }; var defaultSorter = new ExpressionSorter <ParticipantStatusDTO>(x => x.Id, SortDirection.Ascending); var queryOperator = new QueryableOperator <ParticipantStatusDTO>(0, 10, defaultSorter); var serviceResults = service.Get(queryOperator); var serviceResultsAsync = await service.GetAsync(queryOperator); tester(serviceResults); tester(serviceResultsAsync); }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="updater">The user performing the update.</param> /// <param name="participantId">The participant id.</param> /// <param name="projectId">The project id.</param> /// <param name="hostInstitutionId">The host institution id.</param> /// <param name="homeInstitutionId">The home institution id.</param> /// <param name="hostInstitutionAddressId">The host instutition address id.</param> /// <param name="homeInstitutionAddressId">The home institutution address id.</param> /// <param name="participantTypeId">The participant type id.</param> /// <param name="participantStatusId">The participant status id.</param> public UpdatedParticipantPerson( User updater, int participantId, int projectId, int?hostInstitutionId, int?homeInstitutionId, int?hostInstitutionAddressId, int?homeInstitutionAddressId, int participantTypeId, int?participantStatusId, int?placementOrganizationId, int?placementOrganizationAddressId) { if (ParticipantType.GetStaticLookup(participantTypeId) == null) { throw new UnknownStaticLookupException(String.Format("The participant type id [{0}] is not recognized.", participantTypeId)); } if (participantStatusId.HasValue && ParticipantStatus.GetStaticLookup(participantStatusId.Value) == null) { throw new UnknownStaticLookupException(String.Format("The participant status id [{0}] is not recognized.", participantStatusId)); } this.Audit = new Update(updater); this.ProjectId = projectId; this.ParticipantId = participantId; this.HostInstitutionId = hostInstitutionId; this.HostInstitutionAddressId = hostInstitutionAddressId; this.HomeInstitutionAddressId = homeInstitutionAddressId; this.HomeInstitutionId = homeInstitutionId; this.ParticipantTypeId = participantTypeId; this.ParticipantStatusId = participantStatusId; this.PlacementOrganizationId = placementOrganizationId; this.PlacementOrganizationAddressId = placementOrganizationAddressId; }
public void TestCreateGetParticipantPersonsSevisDTOByIdQuery_ParticipantIsNotAPerson() { var status = new ParticipantStatus { ParticipantStatusId = 1, Status = "status", }; var participantType = new ParticipantType { IsPerson = true, Name = "part type", ParticipantTypeId = 90 }; var participant = new Participant { ParticipantId = 1, Status = status, ParticipantStatusId = status.ParticipantStatusId, ProjectId = 250, ParticipantTypeId = participantType.ParticipantTypeId, ParticipantType = participantType, }; context.ParticipantTypes.Add(participantType); context.ParticipantStatuses.Add(status); context.Participants.Add(participant); var results = ParticipantPersonsSevisQueries.CreateGetParticipantPersonsSevisDTOByIdQuery(context, participant.ProjectId, participant.ParticipantId).ToList(); Assert.AreEqual(0, results.Count()); }
public static GKTurnBasedParticipantStatus ToGKTurnBasedParticipantStatus(this ParticipantStatus status) { switch (status) { case ParticipantStatus.Declined: return(GKTurnBasedParticipantStatus.Declined); case ParticipantStatus.Done: return(GKTurnBasedParticipantStatus.Done); case ParticipantStatus.Invited: return(GKTurnBasedParticipantStatus.Invited); case ParticipantStatus.Joined: return(GKTurnBasedParticipantStatus.Active); case ParticipantStatus.Matching: return(GKTurnBasedParticipantStatus.Matching); case ParticipantStatus.Left: case ParticipantStatus.NotInvitedYet: case ParticipantStatus.Unknown: case ParticipantStatus.Unresponsive: default: return(GKTurnBasedParticipantStatus.Unknown); } }
public void TestCreateGetSimplePersonDTOsQuery_PlaceOfBirthIsUnknown() { var person = new Person { FullName = "fullname", Gender = new Gender { GenderId = Gender.Female.Id, GenderName = Gender.Female.Value }, IsPlaceOfBirthUnknown = true }; var status = new ParticipantStatus { ParticipantStatusId = 1, Status = "status" }; var participant = new Participant { Status = status, Person = person, }; context.ParticipantStatuses.Add(status); person.Participations.Add(participant); context.People.Add(person); context.Genders.Add(person.Gender); var result = PersonQueries.CreateGetSimplePersonDTOsQuery(context).First(); Assert.AreEqual(result.IsPlaceOfBirthUnknown, result.IsPlaceOfBirthUnknown); }
public void TestCreateGetSimplePersonDTOsQuery_DoesNotHavePlaceOfBirth() { var person = new Person { FullName = "fullname", Gender = new Gender { GenderId = Gender.Female.Id, GenderName = Gender.Female.Value } }; var status = new ParticipantStatus { ParticipantStatusId = 1, Status = "status" }; var participant = new Participant { Status = status, Person = person, }; context.ParticipantStatuses.Add(status); person.Participations.Add(participant); context.People.Add(person); context.Genders.Add(person.Gender); var result = PersonQueries.CreateGetSimplePersonDTOsQuery(context).First(); Assert.IsNull(result.CityOfBirthId); Assert.IsNull(result.CityOfBirth); }
public ParticipationChangedEvent(Guid participationId, Guid eventId, Guid diverId, ParticipantStatus status) { ParticipationId = participationId; EventId = eventId; DiverId = diverId; Status = status; }
public void TestCreateGetSimplePersonDTOsQuery_CheckDateOfBirth() { var person = new Person { DateOfBirth = DateTime.UtcNow, IsDateOfBirthEstimated = true, FullName = "fullname", Gender = new Gender { GenderId = Gender.Female.Id, GenderName = Gender.Female.Value } }; var status = new ParticipantStatus { ParticipantStatusId = 1, Status = "status" }; var participant = new Participant { Status = status, Person = person, }; context.ParticipantStatuses.Add(status); person.Participations.Add(participant); context.People.Add(person); context.Genders.Add(person.Gender); var result = PersonQueries.CreateGetSimplePersonDTOsQuery(context).First(); Assert.AreEqual(person.DateOfBirth, result.DateOfBirth); Assert.AreEqual(person.IsDateOfBirthEstimated, result.IsDateOfBirthEstimated); }
public void Edit_Succuss(ParticipantStatus status, string buddyTeam, int countPpl, string note, int expectedCountPpl) { // Arrange var participant = new Participant { Id = validParticipantId, EventId = validEventId, ParticipatingDiverId = validDiverId, BuddyTeamName = "team1", CountPeople = 1, Status = ParticipantStatus.None, Note = null, }; // Act participant.Edit(status, buddyTeam, countPpl, note); // Assert participant.Status.Should().Be(status); participant.BuddyTeamName.Should().Be(buddyTeam); participant.CountPeople.Should().Be(expectedCountPpl); participant.Note.Should().Be(note); participant.Id.Should().Be(validParticipantId); participant.EventId.Should().Be(validEventId); participant.ParticipatingDiverId.Should().Be(validDiverId); participant.UncommittedDomainEvents.Should().ContainSingle(e => e.GetType() == typeof(ParticipationChangedEvent)); }
private void OnTriggerStay(Collider other) { if (leftController.controller.GetHairTriggerUp() || rightController.controller.GetHairTriggerUp()) { //reset selection state TestState.SetSelectedFalse(); //reset all buttons back to grey (no choice) for (int i = 0; i < 4; i++) { TestButtons[i].GetComponent <Renderer>().material = material; } if (trials > 0) { //Despawn current box bool any = true; this.GetComponent <DespawnObject>().buttonDespawn(any); ps.GetNextStimulus(); trials--; Debug.Log("test trials left " + trials); //Spawn new box bool always = true; this.GetComponent <SpawnRandomBox>().spawn(always); } else { this.GetComponent <DespawnObject>().buttonDespawn(); Debug.Log("showing instructions"); ParticipantStatus.GetInstance().ResetCubes(); SceneManager.LoadScene("ParticipantInstructions", LoadSceneMode.Single); } } }
internal Participant(string displayName, string participantId, ParticipantStatus status, GooglePlayGames.BasicApi.Multiplayer.Player player, bool connectedToRoom) { this.mDisplayName = displayName; this.mParticipantId = participantId; this.mStatus = status; this.mPlayer = player; this.mIsConnectedToRoom = connectedToRoom; }
internal Participant(string displayName, string participantId, ParticipantStatus status, Player player, bool connectedToRoom) { mDisplayName = displayName; mParticipantId = participantId; mStatus = status; mPlayer = player; mIsConnectedToRoom = connectedToRoom; }
// Use this for initialization void Start() { ps = ParticipantStatus.GetInstance(); player = GameObject.FindGameObjectWithTag("MainCamera"); // this responds to head movements, Player doesn't Debug.Log("Player", player); previousSide = -1; trial = -1; }
public static ParticipantStatus GetInstance() { if (ps == null) { ps = new ParticipantStatus(); } return(ps); }
public void TestCreateGetSimplePersonDTOsQuery_CheckPlaceOfBirth() { var country = new Location { LocationName = "country", LocationId = 1 }; var division = new Location { LocationName = "division", LocationId = 2 }; var city = new Location { LocationName = "city", LocationId = 3, Division = division, DivisionId = division.LocationId, Country = country, CountryId = country.LocationId }; var person = new Person { FullName = "fullname", Gender = new Gender { GenderId = Gender.Female.Id, GenderName = Gender.Female.Value }, PlaceOfBirth = city, PlaceOfBirthId = city.LocationId }; var status = new ParticipantStatus { ParticipantStatusId = 1, Status = "status" }; var participant = new Participant { Status = status, Person = person, }; context.Locations.Add(city); context.Locations.Add(division); context.Locations.Add(country); context.ParticipantStatuses.Add(status); person.Participations.Add(participant); context.People.Add(person); context.Genders.Add(person.Gender); var result = PersonQueries.CreateGetSimplePersonDTOsQuery(context).First(); Assert.AreEqual(city.LocationId, result.CityOfBirthId); Assert.AreEqual(city.LocationName, result.CityOfBirth); Assert.AreEqual(division.LocationName, result.DivisionOfBirth); Assert.AreEqual(country.LocationName, result.CountryOfBirth); }
public void TestCreateGetParticipantPersonsSevisDTOByIdQuery() { var person = new Person { PersonId = 1, FullName = "full name" }; var status = new ParticipantStatus { ParticipantStatusId = 1, Status = "status", }; var participantType = new ParticipantType { IsPerson = true, Name = "part type", ParticipantTypeId = 90 }; var participant = new Participant { ParticipantId = 1, Status = status, ParticipantStatusId = status.ParticipantStatusId, ProjectId = 250, ParticipantTypeId = participantType.ParticipantTypeId, ParticipantType = participantType, Person = person, PersonId = person.PersonId }; var participantPerson = new ParticipantPerson { ParticipantId = participant.ParticipantId, Participant = participant, EndDate = DateTimeOffset.UtcNow.AddDays(10.0), IsCancelled = true, IsDS2019Printed = true, IsDS2019SentToTraveler = true, IsSentToSevisViaRTI = true, IsValidatedViaRTI = true, SevisBatchResult = "sevis batch result", SevisId = "sevis id", SevisValidationResult = "sevis validation result", StartDate = DateTimeOffset.UtcNow.AddDays(-10.0) }; participant.ParticipantPerson = participantPerson; context.People.Add(person); context.ParticipantTypes.Add(participantType); context.ParticipantStatuses.Add(status); context.Participants.Add(participant); context.ParticipantPersons.Add(participantPerson); var results = ParticipantPersonsSevisQueries.CreateGetParticipantPersonsSevisDTOByIdQuery(context, participant.ProjectId, participant.ParticipantId).ToList(); Assert.AreEqual(1, results.Count()); }
public static string ParticipantStatusToString(ParticipantStatus participantStatus) { if (!s_stringByParticipantStatus.TryGetValue(participantStatus, out string result)) { throw new ArgumentException($"Unknown participant status: {participantStatus}"); } return(result); }
public void Edit(ParticipantStatus status, string buddyTeamName, int numberOfPeople, string note) { Status = status; BuddyTeamName = buddyTeamName; CountPeople = Math.Max(1, numberOfPeople); Note = note; RaiseDomainEvent(new ParticipationChangedEvent(Id, EventId, ParticipatingDiverId, Status)); }
public RoleplayParticipant ( [NotNull] Roleplay roleplay, [NotNull] User user ) { this.Roleplay = roleplay; this.User = user; this.Status = ParticipantStatus.None; }
public RoleplayParticipant ( Roleplay roleplay, User user ) { this.Roleplay = roleplay; this.User = user; this.Status = ParticipantStatus.None; }
public DataFarmerObject(string tag) { this.tag = tag; this.timestamp = Time.time; ps = ParticipantStatus.GetInstance(); this.participant = ps.GetParticipant(); this.trial = ps.GetTrial(); this.condition = ps.GetCondition(); this.category = ps.GetCategory(); this.cube = ps.GetCube(); }
public void TestCreateGetRelatedPersonByDependentFamilyMemberQuery_CheckProperties() { var spousePersonType = new DependentType { DependentTypeId = DependentType.Spouse.Id }; var gender = new Gender { GenderId = Gender.Female.Id, GenderName = Gender.Female.Value }; var person = new Person { PersonId = 10, GenderId = gender.GenderId, Gender = gender }; var dependent = new PersonDependent { DependentTypeId = spousePersonType.DependentTypeId, DependentId = 2, PersonId = person.PersonId, FirstName = "firstName", LastName = "lastName", NameSuffix = "III", GenderId = gender.GenderId, Person = person }; var status = new ParticipantStatus { ParticipantStatusId = 1, Status = "status" }; var participant = new Participant { Status = status, Person = person, }; context.ParticipantStatuses.Add(status); person.Participations.Add(participant); person.Family.Add(dependent); context.People.Add(person); context.PersonDependents.Add(dependent); context.DependentTypes.Add(spousePersonType); var result = PersonQueries.CreateGetRelatedPersonByDependentFamilyMemberQuery(context, dependent.DependentId).FirstOrDefault(); Assert.IsNotNull(result); Assert.AreEqual(person.PersonId, result.PersonId); }
public ChangeParticipation(Guid eventId, ParticipantStatus status, int numberOfPeople, string note, string buddyTeamName) { EventId = eventId; Status = status; NumberOfPeople = numberOfPeople; Note = note; BuddyTeamName = buddyTeamName; }
public async Task Handle_Success(ParticipantStatus status, NotificationType expectedNotificationType, string expectedMessage) { // Arrange var notification = new ParticipationChangedEvent( validParticipantId, validEventId, validDiverId, ParticipantStatus.Accepted); A.CallTo(() => participantRepository.GetParticipantByIdAsync(A <Guid> ._)) .ReturnsLazily(call => Task.FromResult( (Guid)call.Arguments[0] == validParticipantId ? new Participant { Id = validParticipantId, EventId = validEventId, ParticipatingDiverId = validDiverId, Status = status, CountPeople = 1, BuddyTeamName = "team1" } : null )); var recordedMessage = ""; A.CallTo(() => notificationPublisher.PublishAsync( expectedNotificationType, A <string> .That.Matches(m => !string.IsNullOrWhiteSpace(m)), A <IEnumerable <Diver> > .That.Matches(l => l.Count() == 2), A <Diver> ._, validEventId, null)).Invokes(call => recordedMessage = (string)call.Arguments[1]); // Act await policy.Handle(notification, CancellationToken.None); // Assert A.CallTo(() => notificationPublisher.PublishAsync( expectedNotificationType, A <string> .That.Matches(m => !string.IsNullOrWhiteSpace(m)), A <IEnumerable <Diver> > .That.Matches(l => l.Count() == 2), A <Diver> ._, validEventId, null)) .MustHaveHappenedOnceExactly(); recordedMessage.Should().Be(expectedMessage); }
public void Ctor_NewParticipationSuccess(ParticipantStatus status) { // Act var participant = new Participant(validEventId, validDiverId, status, "team1", 1, null); // Assert participant.EventId.Should().Be(validEventId); participant.ParticipatingDiverId.Should().Be(validDiverId); participant.Status.Should().Be(status); participant.CountPeople.Should().Be(1); participant.BuddyTeamName.Should().Be("team1"); participant.Note.Should().BeNull(); participant.UncommittedDomainEvents.Should().ContainSingle(c => c.GetType() == typeof(ParticipationChangedEvent)); }
// makes a cube from a description of the 3 axes // for a description of this see ColorShapeRotation.cs // a CubeTuple describes a cube // mapping of cubes to categories is stored externally // as json data // for any participant we pick one set of mappings // and go through them somewhat randomly // I guess this is the current version of the "nice function" // this pulls the materials based on what we get for // the externally generated counterbalancing conditions // and maps the materials to the raw cube Material[] createSet() { CubeTuple c = ParticipantStatus.GetInstance().GetCube(); Material[] matlist = rend.materials; matlist[0] = material[0]; foreach (ColorShapeRotation csr in c.cube) { foreach (int face in csr.GetFaces()) { matlist[face] = material[csr.GetMaterial()]; } } return(matlist); }
public void TestCreateGetSimplePersonDTOsQuery_CheckNames() { var person = new Person { Alias = "alias", FamilyName = "family", FirstName = "firstName", GivenName = "givenName", LastName = "lastName", MiddleName = "middleName", NamePrefix = "Mr.", NameSuffix = "III", Patronym = "patronym", FullName = "fullname", Gender = new Gender { GenderId = Gender.Female.Id, GenderName = Gender.Female.Value } }; var status = new ParticipantStatus { ParticipantStatusId = 1, Status = "status" }; var participant = new Participant { Status = status, Person = person, }; context.ParticipantStatuses.Add(status); person.Participations.Add(participant); context.People.Add(person); context.Genders.Add(person.Gender); var result = PersonQueries.CreateGetSimplePersonDTOsQuery(context).First(); Assert.AreEqual(person.Alias, result.Alias); Assert.AreEqual(person.FamilyName, result.FamilyName); Assert.AreEqual(person.FirstName, result.FirstName); Assert.AreEqual(person.GivenName, result.GivenName); Assert.AreEqual(person.LastName, result.LastName); Assert.AreEqual(person.MiddleName, result.MiddleName); Assert.AreEqual(person.NamePrefix, result.NamePrefix); Assert.AreEqual(person.Patronym, result.Patronym); Assert.AreEqual(person.FullName, result.FullName); }
public EventParticipationViewModel( Guid eventId, [NotNull] IEnumerable <string> buddyTeamNames, [NotNull] IEnumerable <EventParticipantViewModel> participants, ParticipantStatus currentUserStatus, string currentUserNote, string currentUserBuddyTeamName, int currentUserCountPeople) { EventId = eventId; BuddyTeamNames = buddyTeamNames ?? throw new ArgumentNullException(nameof(buddyTeamNames)); Participants = participants ?? throw new ArgumentNullException(nameof(participants)); CurrentUserStatus = currentUserStatus; CurrentUserNote = currentUserNote; CurrentUserBuddyTeamName = currentUserBuddyTeamName; CurrentUserCountPeople = currentUserCountPeople; }