public void Index_GivenRadioObject_ReturnViewDataWithPropertiesSet() { var view = new SearchView(McmRepository.Object); var obj = Make_Radio_Object(); var result = (SearchViewData) view.Index(obj).First(); Assert.AreEqual(result.Identifier, "00000000-0000-0000-0000-000000000001"); Assert.AreEqual(result.Title, "EXPO 2005"); Assert.AreEqual(result.Type, "Radio"); Assert.AreEqual(result.PubStartDate, "2005-08-10T12:00:00Z"); Assert.AreEqual(result.PubEndDate, "2005-08-10T12:05:00Z"); Assert.AreEqual(result.PubStartDate, (Helpers.DateTimeHelper.ParseAndFormatDate("2005-08-10T12:00:00Z"))); Assert.AreEqual(result.PubEndDate, Helpers.DateTimeHelper.ParseAndFormatDate("2005-08-10T12:05:00Z")); Assert.AreEqual(result.Duration, "00:05:00"); var indexableFields = result.GetIndexableFields().ToList(); Assert.AreEqual(indexableFields.Any(item => item.Key == "Id" && item.Value == "00000000-0000-0000-0000-000000000001"), true); Assert.AreEqual(indexableFields.Any(item => item.Key == "Title" && item.Value == "EXPO 2005"), true); var fullText = indexableFields.First(item => item.Key == "FreeText").Value; Assert.AreEqual(indexableFields.Any(item => item.Key == "Type" && item.Value == "Radio"), true); Assert.AreEqual(indexableFields.First(item => item.Key == "FreeText").Value, ("2005-08-10T12:00:00Z\r\n2005-08-10T12:05:00Z\r\nDR, P1\r\nEXPO 2005\r\nShort piece for current culture program about EXPO in Nagoya, Japan\r\nthis is a test, dates are not factual\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n ")); Assert.AreEqual(indexableFields.First(item => item.Key == "Duration").Value, ("300")); Assert.AreEqual(indexableFields.First(item => item.Key == "PubStartDate").Value, ("2005-08-10T12:00:00Z")); Assert.AreEqual(indexableFields.First(item => item.Key == "PubEndDate").Value, ("2005-08-10T12:05:00Z")); }
public void Index_GivenScheduleNoteObject_ReturnViewDataWithPropertiesSet() { var view = new SearchView(McmRepository.Object); var obj = Make_ScheduleNote_Object(); var result = (SearchViewData)view.Index(obj).First(); Assert.AreEqual(result.Identifier, ("00000000-0000-0000-0000-000000000003")); Assert.AreEqual(result.Title, ("A-1964-10-24-S-0321.pdf")); Assert.AreEqual(result.Type, ("ScheduleNote")); Assert.AreEqual(result.FreeText, ("Test data content.")); Assert.AreEqual(result.Url, ("http://s3-eu-west-1.amazonaws.com/chaosdata/Hvideprogrammer/arkiv_A/1964_10_2/PDF/A-1964-10-24-S-0321.pdf")); Assert.AreEqual(result.PubStartDate, ("1964-10-24T00:00:00Z")); Assert.AreEqual(result.PubStartDate, (Helpers.DateTimeHelper.ParseAndFormatDate("1964-10-24T00:00:00"))); Assert.AreEqual(result.PubEndDate, (string.Empty)); }
public void Index_GivenObjectWithNoMetadata_ReturnEmptyList() { var view = new SearchView(McmRepository.Object); var obj = new Object { Guid = new Guid("10000000-0000-0000-0000-000000000001"), ObjectTypeID = 64 }; var result = view.Index(obj); Assert.That(result, Is.Empty); }