public static Attendee?ProvideAttendee(List <Attendee> attendees) { var isAttendeeInputDone = false; Attendee foundAttendee = null; while (isAttendeeInputDone == false) { Console.WriteLine(); Console.WriteLine("Molimo vas unesite OIB osobe:"); var queryPin = Console.ReadLine(); foundAttendee = AttendeeRepository.GetByPIN(attendees, queryPin); if (foundAttendee is Attendee == false) { Console.WriteLine($"Osoba sa OIB-om ({queryPin}) nije trenutno prijavljena na odabrani event."); isAttendeeInputDone = (UserDialogDataProvider.IsActionRepeatRequested() == false); } else { isAttendeeInputDone = true; } Console.WriteLine(); } return(foundAttendee); }
public void GetByIdTestFail() { var arrepo = new AttendeeRepository(arcontextmock.Object); var arobj = arrepo.GetById(88); Assert.IsNull(arobj); }
public void GetAllTest() { /*AttendeeRepository attendeerecord = new AttendeeRepository(_dbcontext); * AttendeeRecordsController attenderecordobj = new AttendeeRecordsController(attendeerecord); * var result = attenderecordobj.GetAllAttendees(); * var response = result as OkObjectResult;*/ var attenrepo = new AttendeeRepository(arcontextmock.Object); var attendeelist = attenrepo.GetAll(); Assert.AreEqual(2, attendeelist.Count()); }
public void GetAll_ShouldReturn_All_Attendees_InThe_Database() { //Arrange int expectedCount; using (DayOfDotNetDataContext dc = new DayOfDotNetDataContext()) { expectedCount = (from x in dc.Attendees select x).Count(); } //Act IAttendeeRepository attendeeRepository = new AttendeeRepository(); IList<AttendeeDTO> attendees = attendeeRepository.GetAll(); //Assert attendees.Count.ShouldEqual(expectedCount); }
public void GetAllEligible_ShouldReturn_All_Attendess_InThe_Database_Where_IsEligible_Equals_True() { //Arrange int expectedCount; using (var dc = new DayOfDotNetDataContext()) { expectedCount = (from x in dc.Attendees where x.IsEligible select x).Count(); } //Act IAttendeeRepository attendeeRepository = new AttendeeRepository(); IList<AttendeeDTO> attendees = attendeeRepository.GetAllEligible(); //Assert attendees.Count.ShouldEqual(expectedCount, "Wrong number of attendess"); (from x in attendees where !x.IsEligible select x).Count().ShouldEqual(0, "Expected 0 Non-Eligible Attendees"); }
public void DeleteAll_ShouldDelete_All_Attendees() { //Arrange using (new TransactionScope()) { //Act IAttendeeRepository repo = new AttendeeRepository(); bool successful = repo.DeleteAll(); //Assert successful.ShouldBeTrue("Expected True"); using (var dc = new DayOfDotNetDataContext()) { (from x in dc.Attendees select x).Count().ShouldEqual(0, "Expected 0 Attendees"); } } }
public ActionResult GetAttendees(string searchTerm, int pageSize, int pageNum) { //Get the paged results and the total count of the results for this query. AttendeeRepository ar = new AttendeeRepository(); List <LocationMaster> attendees = ar.GetAttendees(searchTerm, pageSize, pageNum); int attendeeCount = ar.GetAttendeesCount(searchTerm, pageSize, pageNum); //Translate the attendees into a format the select2 dropdown expects Select2PagedResult pagedAttendees = AttendeesToSelect2Format(attendees, attendeeCount); //Return the data as a jsonp result return(new JsonpResult { Data = pagedAttendees, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public void Event_Dispatch_CanSendICS() { EventRepository eventRepo = new EventRepository(_uow); AttendeeRepository attendeesRepo = new AttendeeRepository(_uow); List<AttendeeDO> attendees = new List<AttendeeDO> { _fixture.TestAttendee1(), _fixture.TestAttendee2() }; attendees.ForEach(attendeesRepo.Add); EventDO eventDO = new EventDO { Description = "This is my test invitation", Summary = @"My test invitation", Location = @"Some place!", StartDate = DateTime.Today.AddMinutes(5), EndDate = DateTime.Today.AddMinutes(15), Attendees = attendees, Emails = new List<EmailDO>() }; eventRepo.Add(eventDO); Calendar.DispatchEvent(_uow, eventDO); //Verify success //use imap to load unread messages from the test customer account //verify that one of the messages is a proper ICS message //retry every 15 seconds for 1 minute //create an Email message addressed to the customer and attach the file. //skip for v.1: add EmailID to outbound queue }
public void InsertAll_ShouldInsertAllTheSupplied_Attendees() { //Arrange AttendeeDTO attendee1 = new AttendeeDTO {FirstName = "FName1", LastName = "LName1", Company = "Company1", Email = "*****@*****.**", IsEligible = true, HasWon = true}; AttendeeDTO attendee2 = new AttendeeDTO {FirstName = "FName2", LastName = "LName2", Company = "Company2", Email = "*****@*****.**", IsEligible = false, HasWon = false}; IList<AttendeeDTO> attendees = new List<AttendeeDTO>{attendee1,attendee2}; using (new TransactionScope()) { using (var dc = new DayOfDotNetDataContext()) { dc.ExecuteCommand("Delete from Winner"); dc.ExecuteCommand("Delete from Attendee"); } //Act IAttendeeRepository repo = new AttendeeRepository(); bool successful = repo.InsertAll(attendees); //Assert successful.ShouldBeTrue("Expected True"); using (var dc = new DayOfDotNetDataContext()) { (from x in dc.Attendees select x).Count().ShouldEqual(2, "Expected 2 Attendees"); } } }
static void Main(string[] args) { AttendeeRepository _repository = new AttendeeRepository() { Settings = Settings }; var input = "@barcampphilly #ohai"; var scrubbed = HttpUtility.UrlEncode(input); var reader = XmlReader.Create(string.Format("http://search.twitter.com/search.atom?&q={0}&rpp=100", scrubbed)); var feed = SyndicationFeed.Load(reader); // Order these backwards so we allways do the newest feeds list since I suck at upserts foreach (SyndicationItem item in feed.Items.OrderBy(x=>x.Id)) { Attendee attendee = new Attendee { Name = item.Authors[0].Name, TwitterURL = item.Authors[0].Uri, AvatarURL = item.Links[1].Uri.AbsoluteUri }; // This whole situation here is cheese. C# arrays are annoying. string tweet = item.Title.Text; string[] tweetTags = tweet.Split(' '); string[] userTags = new string[20]; int i = 0; foreach (string tag in tweetTags) { if (tag.Contains("#") && (!tag.Contains("#ohai"))) { userTags[i] = tag.Replace("#",""); i++; } } attendee.Tags = userTags; // Really should try and get upserts working. Stop sucking already, Toto! _repository.Remove(new { TwitterURL = attendee.TwitterURL }); _repository.Create(attendee); } }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(58, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(92, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(142, 2, true); WriteLiteral("\r\n"); EndContext(); #line 8 "D:\ProjectNET\CompanyMVC\CompanyMVC\Views\Conference\Index.cshtml" ViewData["Title"] = "Index"; #line default #line hidden BeginContext(185, 320, true); WriteLiteral(@" <h1>Index</h1> <div class=""row""> <div style=""overflow-x:auto;""> <table class=""table""> <tr> <th>Name</th> <th>Location</th> <th>Start of event</th> <th>Attendees</th> <th>Actions</th> </tr> "); EndContext(); #line 24 "D:\ProjectNET\CompanyMVC\CompanyMVC\Views\Conference\Index.cshtml" foreach (var conference in Model) { #line default #line hidden BeginContext(568, 46, true); WriteLiteral(" <tr>\r\n <td>"); EndContext(); BeginContext(615, 15, false); #line 27 "D:\ProjectNET\CompanyMVC\CompanyMVC\Views\Conference\Index.cshtml" Write(conference.Name); #line default #line hidden EndContext(); BeginContext(630, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(662, 19, false); #line 28 "D:\ProjectNET\CompanyMVC\CompanyMVC\Views\Conference\Index.cshtml" Write(conference.Location); #line default #line hidden EndContext(); BeginContext(681, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(713, 39, false); #line 29 "D:\ProjectNET\CompanyMVC\CompanyMVC\Views\Conference\Index.cshtml" Write(conference.Start.ToString("dd-mm-yyyy")); #line default #line hidden EndContext(); BeginContext(752, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(784, 51, false); #line 30 "D:\ProjectNET\CompanyMVC\CompanyMVC\Views\Conference\Index.cshtml" Write(AttendeeRepository.GetAttendeesTotal(conference.Id)); #line default #line hidden EndContext(); BeginContext(835, 57, true); WriteLiteral("</td>\r\n <td>\r\n "); EndContext(); BeginContext(892, 101, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9e099400089749eb221278578ded8143a1bf40936836", async() => { BeginContext(980, 9, true); WriteLiteral("Proposals"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-conferenceId", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 32 "D:\ProjectNET\CompanyMVC\CompanyMVC\Views\Conference\Index.cshtml" WriteLiteral(conference.Id); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["conferenceId"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-conferenceId", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["conferenceId"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(993, 52, true); WriteLiteral("\r\n </td>\r\n </tr>\r\n"); EndContext(); #line 35 "D:\ProjectNET\CompanyMVC\CompanyMVC\Views\Conference\Index.cshtml" } #line default #line hidden BeginContext(1060, 26, true); WriteLiteral(" </table>\r\n "); EndContext(); BeginContext(1086, 27, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9e099400089749eb221278578ded8143a1bf40939756", async() => { BeginContext(1106, 3, true); WriteLiteral("Add"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1113, 22, true); WriteLiteral("\r\n\r\n </div>\r\n</div>"); EndContext(); }
private List <Attendee> GetAttendees() { var attendees = AttendeeRepository.GetAttendees(); return(attendees.ToList()); }
public void ResetAllHasWon_ShouldSetThe_HasWon_Flag_To_False_OnAll_Attendees() { //Arrange using (new TransactionScope()) { using (var dc = new DayOfDotNetDataContext()) { Attendee attendee = (from x in dc.Attendees where x.IsEligible && !x.HasWon select x).FirstOrDefault(); attendee.HasWon = true; dc.SubmitChanges(); } //Act IAttendeeRepository repo = new AttendeeRepository(); bool successful = repo.ResetAllHasWon(); //Assert successful.ShouldBeTrue("Expected True"); using (var dc = new DayOfDotNetDataContext()) { (from x in dc.Attendees where x.HasWon select x).Count().ShouldEqual(0, "Expected 0 HasWon == True"); } } }
public void SetHasWon_ShouldSetThe_HasWon_Flag_To_True_OnThe_Attendee_WithTheSpecified_AttendeeID() { //Arrange long attendeeID; using (new TransactionScope()) { using (var dc = new DayOfDotNetDataContext()) { Attendee attendee = (from x in dc.Attendees where x.IsEligible && !x.HasWon select x).FirstOrDefault(); attendee.HasWon = true; attendeeID = attendee.AttendeeID; dc.SubmitChanges(); } //Act IAttendeeRepository repo = new AttendeeRepository(); bool successful = repo.SetHasWon(attendeeID); //Assert successful.ShouldBeTrue("Expected True"); using (var dc = new DayOfDotNetDataContext()) { (from x in dc.Attendees where x.AttendeeID == attendeeID select x.HasWon).FirstOrDefault().ShouldBeTrue("Expected True"); } } }
public HomeController() { _repository = new AttendeeRepository() { Settings = Settings }; }