public void NotifyUser() { var exhibitCommand = new Create.Command { GenreId = 1, UserId = "id", Location = "aperture gallery", DateTime = DateTime.Today, ImageUrl = "url" }; var exhibit = Exhibit.Create(exhibitCommand); var user = new ApplicationUser { Email = _testUsername, Name = _testName, ImageUrl = _testImageUrl }; var notification = Notification.ExhibitCreated(exhibit); user.Notify(notification); var userNotification = user.UserNotifications.SingleOrDefault(); Assert.Equal(_testName, userNotification.User.Name); }
public async Task Should_return_all_exhibits() { var exhibitCommand = new Create.Command { GenreId = 1, UserId = "id", Location = "aperture gallery", DateTime = DateTime.Today, ImageUrl = "url" }; var exhibit = Exhibit.Create(exhibitCommand); var attendanceCommand = new Attend.Command { UserId = _attendeeId, ExhibitId = _exhibitId }; var attendance = Attendance.Create(attendanceCommand); exhibit.AddAttendance(attendance); await InsertAsync(exhibit); var result = await SendAsync(new Index.Query()); result.ShouldNotBeNull(); }
public void ExhibitCanceled() { var exhibitCommand = new Create.Command { GenreId = 1, UserId = "id", Location = "aperture gallery", DateTime = DateTime.Today, ImageUrl = _testImageUrl }; var exhibit = Exhibit.Create(exhibitCommand); exhibit.Cancel(); Assert.Equal(_testCanceled, exhibit.IsCanceled); }
public async Task Handle(Command message) { var uploadPath = Path.Combine(_environment.WebRootPath, "images/exhibits"); var ImageName = ContentDispositionHeaderValue.Parse(message.ImageUpload.ContentDisposition).FileName.Trim('"'); using (var fileStream = new FileStream(Path.Combine(uploadPath, message.ImageUpload.FileName), FileMode.Create)) { await message.ImageUpload.CopyToAsync(fileStream); message.ImageUrl = "http://exhibitbaseurl/images/exhibits/" + ImageName; } message.DateTime = DateTime.Parse(string.Format("{0}", message.Date)); var exhibit = Exhibit.Create(message); _repository.Add(exhibit); _repository.SaveAll(); }
public void ExhibitUpdated() { var exhibitCommand = new Create.Command { GenreId = 1, UserId = "id", Location = _testLocation, DateTime = DateTime.Today, ImageUrl = _testImageUrl }; var exhibit = Exhibit.Create(exhibitCommand); exhibit.ManagerUpdate( _testNewLocation, DateTime.Today, _testNewImageUrl); Assert.Equal(_testNewImageUrl, exhibit.ImageUrl); }
public void UpdatedExhibitNotification() { var exhibitCommand = new Create.Command { GenreId = 1, UserId = "id", Location = "aperture gallery", DateTime = DateTime.Today, ImageUrl = "url" }; var user = new ApplicationUser { Email = _testUsername, Name = _testName, ImageUrl = _testImageUrl }; var exhibit = Exhibit.Create(exhibitCommand); var notification = Notification.ExhibitUpdated(exhibit, _testOriginalDateTime, _testOriginalLocation); Assert.Equal(_testNotificationType, notification.Type); }
public void SuspendUser() { var exhibitCommand = new Create.Command { GenreId = 1, UserId = "id", Location = "aperture gallery", DateTime = DateTime.Today, ImageUrl = "url" }; var user = new ApplicationUser { Email = _testUsername, Name = _testName, ImageUrl = _testImageUrl }; var exhibit = Exhibit.Create(exhibitCommand); var notification = Notification.ExhibitCreated(exhibit); user.Suspend(); Assert.Equal(_testIsSuspended, user.IsSuspended); }
public void DetailsUpdated() { var exhibitCommand = new Create.Command { GenreId = 1, UserId = "id", Location = _testLocation, DateTime = DateTime.Today, ImageUrl = _testImageUrl }; var exhibit = Exhibit.Create(exhibitCommand); var exhibitEditCommand = new Edit.Command { Location = _testNewLocation, DateTime = DateTime.Today, ImageUrl = _testNewImageUrl }; exhibit.UpdateDetails(exhibitEditCommand); Assert.Equal(_testNewImageUrl, exhibit.ImageUrl); }
public void IsReadIsTrue() { var exhibitCommand = new Create.Command { GenreId = 1, UserId = "id", Location = "aperture gallery", DateTime = DateTime.Today, ImageUrl = "url" }; var exhibit = Exhibit.Create(exhibitCommand); var attendanceCommand = new Attend.Command { UserId = _attendeeId, ExhibitId = _exhibitId }; var attendance = Attendance.Create(attendanceCommand); exhibit.AddAttendance(attendance); Assert.Equal(_exhibitId, exhibit.Attendances.SingleOrDefault().ExhibitId); Assert.Equal(_attendeeId, exhibit.Attendances.SingleOrDefault().AttendeeId); }