public DetailViewModel(SpeakerService SpeakerService) { Title = "Speaker detail"; Subtitle = "In this section you can see the detailed data of an speaker."; this.SpeakerService = SpeakerService; }
public GetAll() { _fakeRepository = new FakeRepository(); SpeakerFactory.Create(_fakeRepository); _speakerService = new SpeakerService(_fakeRepository); }
public void ReadAllSpeakers_ShouldReturnAList() { var speakerRepo = new Mock <ISpeakerRepository>(); var brandRepo = new Mock <IBrandRepository>(); ISpeakerService speakerService = new SpeakerService(speakerRepo.Object, brandRepo.Object); var filter = new Filter() { ItemsPrPage = 1, CurrentPage = 1, Price = 10, Brand = "Bose" }; speakerRepo.Setup(x => x.ReadAllSpeakers(filter)).Returns(new List <Speaker>() { new Speaker() { SpeakerId = 1, SpeakerBrand = new Brand() { SpeakerBrand = "test" }, SpeakerDescription = "test", SpeakerName = "test", Color = "test", Price = 1234 } }); var list = speakerService.ReadAllSpeakers(filter); Assert.NotEmpty(list); }
public async void OnNavigatingTo(INavigationParameters parameters) { var data = await SpeakerService.GetAsync(); Speakers.Clear(); foreach (var item in data) { Speakers.Add(new Speaker { Name = item.Name, Bio = item.Bio, HeadshotImage = item.PhotoLink, Sessions = item.Sessions.Select(x => new Session { Title = x.Title, Description = x.Description, IsFavorite = false, Room = x.Room, TimeSlot = x.TimeSlot, TimeSlotName = x.TimeSlotName, Track = x.Category.ToSessionTrack(), Speaker = new Speaker { Name = item.Name, HeadshotImage = item.PhotoLink } }) }); } }
public ListViewModel(SpeakerService SpeakerService) { Title = "Speaker dashboard"; Subtitle = "In this section you can see the list of speakers registered in the database."; this.SpeakerService = SpeakerService; }
public void ReadByIdIsBelowZero() { var speakerRepo = new Mock <ISpeakerRepository>(); var brandRepo = new Mock <IBrandRepository>(); ISpeakerService speakerService = new SpeakerService(speakerRepo.Object, brandRepo.Object); var speaker = new Speaker() { SpeakerId = 0, SpeakerName = "Test", SpeakerBrand = new Brand() { SpeakerBrand = "test" }, SpeakerDescription = "Test", Color = "Blue", Price = 1123 }; Exception exception = Assert.Throws <InvalidDataException>(() => speakerService.ReadSpeakerById(speaker.SpeakerId)); Assert.Equal("The entered speaker ID is invalid", exception.Message); }
protected override void OnInitialized() { editContext = new EditContext(Report); editContext.OnFieldChanged += HandleFieldChanged; speakers = SpeakerService.GetSpeakers().ToImmutableArray(); conferences = ConferenceService.GetConferences().ToImmutableArray(); if (Report.Speakers is { })
public EditViewModel(SpeakerService SpeakerService) { Title = "Edit organizer"; Subtitle = "In this section, you can edit an speaker's data."; this.SpeakerService = SpeakerService; }
public CreateViewModel(SpeakerService SpeakerService) { Title = "Create speaker"; Subtitle = "In this section you can create a new speaker."; this.SpeakerService = SpeakerService; }
public TalkController(TalkService talkService, SpeakerService speakerService, CityService cityService, PlaceService placeService, AuthenticationProvider authenticationProvider) { _talkService = talkService; _speakerService = speakerService; _cityService = cityService; _placeService = placeService; _authenticationProvider = authenticationProvider; }
public SpeakerTestContext() { var context = new InMemoryDataContext(); var repository = new Repository(context); _speakerService = new SpeakerService(repository); _unitOfWork = context; }
// public EditViewModel(SessionService SessionService, SpeakerService SpeakerService) { Title = "Edit session"; Subtitle = "In this section, you can edit an session's data."; this.SessionService = SessionService; this.SpeakerService = SpeakerService; }
private async void getSpeakersAsync() { var speakerService = new SpeakerService(); var speakers = await speakerService.GetSpeakersAsync(); speakersTable.Source = new PlainTableSource(speakers.Select(x => x.Name).ToArray()); speakersTable.ReloadData(); }
// public CreateViewModel(SessionService SessionService, SpeakerService SpeakerService) { Title = "Create session"; Subtitle = "In this section you can create a new session."; this.SessionService = SessionService; this.SpeakerService = SpeakerService; }
public async Task ItGetsFeaturedSpeakers() { // Arrange // Act await Controller.GetFeatured(); // Assert SpeakerService.Verify(x => x.GetFeatured(), Times.Once()); }
public async Task ItGetsSpeaker() { // Arrange // Act await Controller.GetBySlug(_slug); // Assert SpeakerService.Verify(x => x.Get(_slug), Times.Once()); }
public async Task ItGetsSpeakers() { // Arrange // Act await Controller.GetAll(0, 1, nameof(Direction.Asc)); // Assert SpeakerService.Verify(x => x.GetAll(0, 1, nameof(Direction.Asc)), Times.Once()); }
public SpeakerController() { string connectionString = "DefaultConnection"; IMappingConfiguration mapping = new FestifyMappingConfiguration(); IDataContext context = new DataContext(connectionString, mapping); IRepository repository = new Repository(context); _unitOfWork = context; _speakerService = new SpeakerService(repository); }
public SpeakerServiceTestBase() { Cache = new Mock <ICacheManager>(); Repository = new Mock <ISpeakerMeetRepository>(); Repository.Setup(x => x.List(It.IsAny <SpeakerSpecification>())) .ReturnsAsync(new List <Speaker>()); Service = new SpeakerService(Cache.Object, Repository.Object); }
/// <summary> /// Initializes a new instance for the <see cref="ArticleListViewModel" /> class. /// </summary> public SpeakersViewModel() { FeaturedStories = new ObservableCollection <Speaker>(); LatestStories = new ObservableCollection <Speaker>(); _speakerService = new SpeakerService(); _backgroundTaskHelper = new BackgroundTaskHelper(GetSpeakers); this.MenuCommand = new Command(this.MenuClicked); this.BookmarkCommand = new Command(this.BookmarkButtonClicked); this.FeatureStoriesCommand = new Command(this.FeatureStoriesClicked); this.ItemSelectedCommand = new Command(this.ItemSelected); }
public void GivenSpeakerNotFoundThenSpeakerNotFoundException() { // Arrange var service = new SpeakerService(_fakeRepository, _fakeGravatarService); // Act var exception = Record.Exception(() => service.Get(-1)); // Assert Assert.IsAssignableFrom <SpeakerNotFoundException>(exception); }
public Search() { var fakeRepository = new FakeRepository(); SpeakerFactory.Create(fakeRepository); SpeakerFactory.Create(fakeRepository, name: "Josh"); SpeakerFactory.Create(fakeRepository, name: "Joseph"); SpeakerFactory.Create(fakeRepository, name: "Bill"); _speakerService = new SpeakerService(fakeRepository); }
public async Task GivenException_ThenBadRequestResult() { // Arrange SpeakerService.Setup(x => x.GetFeatured()).Throws(new Exception()); // Act var result = await Controller.GetFeatured(); // Assert Assert.IsAssignableFrom <BadRequestObjectResult>(result.Result); }
public void ItAcceptsIRepository() { // Arrange var fakeRepository = new FakeRepository(); // Act var service = new SpeakerService(fakeRepository); // Assert Assert.NotNull(service); }
public async Task GivenEntityNotFoundException_ThenBadRequestResult() { // Arrange SpeakerService.Setup(x => x.Get(_slug)).Throws(new EntityNotFoundException()); // Act var result = await Controller.GetBySlug(_slug); // Assert Assert.IsAssignableFrom <NotFoundObjectResult>(result.Result); }
public void GivenSpeakerFoundThenSpeakerDetailReturned() { // Arrange var speakerService = new SpeakerService(_repository, _gravatarService); // Act var speaker = speakerService.Get(1); // Assert Assert.NotNull(speaker); Assert.IsAssignableFrom <SpeakerDetail>(speaker); }
public void GivenSpeakerIsDeletedThenSpeakerNotFoundException() { // Arrange var expectedSpeaker = SpeakerFactory.Create(_fakeRepository).IsDeleted(); var service = new SpeakerService(_fakeRepository, _fakeGravatarService); // Act var exception = Record.Exception(() => service.Get(expectedSpeaker.Id)); // Assert Assert.IsAssignableFrom <SpeakerNotFoundException>(exception); }
public void ItCallsRepository() { // Arrange var expectedSpeaker = SpeakerFactory.Create(_fakeRepository); var service = new SpeakerService(_fakeRepository, _fakeGravatarService); // Act service.Get(expectedSpeaker.Id); // Assert Assert.True(_fakeRepository.GetCalled); }
public void ItReturnsCollectionOfSpeakerSummary() { // Arrange var speakerService = new SpeakerService(_repository, _gravatarService); // Act var speakers = speakerService.GetAll(); // Assert Assert.NotNull(speakers); Assert.IsAssignableFrom <IEnumerable <SpeakerSummary> >(speakers); }
public async Task GivenException_ThenItLogsError() { // Arrange var ex = new Exception(); SpeakerService.Setup(x => x.GetFeatured()).Throws(ex); // Act await Controller.GetFeatured(); // Assert Logger.Verify(x => x.LogError(ex, ex.Message), Times.Once()); }