コード例 #1
0
ファイル: IMDI30Tests.cs プロジェクト: JohnThomson/libpalaso
		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.");
		}
コード例 #2
0
ファイル: IMDI30Tests.cs プロジェクト: JohnThomson/libpalaso
		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.");
		}
コード例 #3
0
ファイル: IMDI30Tests.cs プロジェクト: JohnThomson/libpalaso
		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.");
		}
コード例 #4
0
ファイル: IMDI_3_0.cs プロジェクト: jwickberg/libpalaso
		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();
			}
		}