public void SessionDate_DateRange_ValidStringProduced() { var session = new Session(); const string dateIn = "2013-11-20 to 2013-11-25"; session.SetDate(dateIn); var dateOut = session.Date; Assert.AreEqual(dateIn, dateOut, "The date returned was not what was expected."); }
public void SessionDate_DateTime_ValidStringProduced() { var session = new Session(); var dateIn = DateTime.Today; session.SetDate(dateIn); var dateOut = session.Date; Assert.AreEqual(dateIn.ToString("yyyy-MM-dd"), dateOut, "The date returned was not what was expected."); }
public void SessionDate_YearOnly_ValidStringProduced() { var session = new Session(); const int dateIn = 1964; session.SetDate(dateIn); var dateOut = session.Date; Assert.AreEqual(dateIn.ToString(CultureInfo.InvariantCulture), dateOut, "The date returned was not what was expected."); }
private void ArbilCheckSession(Session session) { if (session.Date == null) session.SetDate(DateTime.Today); if (session.MDGroup.Project.Count == 0) session.MDGroup.Project.Add(new Project()); session.MDGroup.Content.CheckRequiredFields(); foreach (var actor in session.MDGroup.Actors.Actor) { if (actor.Role == null) actor.Role = string.Empty.ToVocabularyType(false, ListType.Link(ListType.ActorRole)); if (actor.FamilySocialRole == null) actor.FamilySocialRole = string.Empty.ToVocabularyType(false, ListType.Link(ListType.ActorFamilySocialRole)); if (actor.Anonymized == null) actor.Anonymized = new BooleanType { Link = ListType.Link(ListType.Boolean) }; if (actor.Sex == null) actor.Sex = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ActorSex) }; } foreach (var file in session.Resources.WrittenResource) { if (file.SubType == null) file.SubType = new VocabularyType { Link = ListType.Link(ListType.WrittenResourceSubType) }; if (file.Validation == null) file.Validation = new ValidationType { Type = new VocabularyType{ Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ValidationType) }, Methodology = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ValidationMethodology) }, Level = new IntegerType { Value = "Unspecified" }, Description = new DescriptionTypeCollection { new LanguageString() } }; if (file.Derivation == null) file.Derivation = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.WrittenResourceDerivation) }; if (file.Anonymized == null) file.Anonymized = new BooleanType { Link = ListType.Link(ListType.Boolean) }; if (file.Access == null) file.Access = new AccessType(); } foreach (var file in session.Resources.MediaFile) { if (file.Access == null) file.Access = new AccessType(); } }