Exemplo n.º 1
0
        public DetailViewModel(SpeakerService SpeakerService)
        {
            Title    = "Speaker detail";
            Subtitle = "In this section you can see the detailed data of an speaker.";

            this.SpeakerService = SpeakerService;
        }
Exemplo n.º 2
0
        public GetAll()
        {
            _fakeRepository = new FakeRepository();
            SpeakerFactory.Create(_fakeRepository);

            _speakerService = new SpeakerService(_fakeRepository);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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
                        }
                    })
                });
            }
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 protected override void OnInitialized()
 {
     editContext = new EditContext(Report);
     editContext.OnFieldChanged += HandleFieldChanged;
     speakers    = SpeakerService.GetSpeakers().ToImmutableArray();
     conferences = ConferenceService.GetConferences().ToImmutableArray();
     if (Report.Speakers is { })
Exemplo n.º 8
0
        public EditViewModel(SpeakerService SpeakerService)
        {
            Title    = "Edit organizer";
            Subtitle = "In this section, you can edit an speaker's data.";

            this.SpeakerService = SpeakerService;
        }
Exemplo n.º 9
0
        public CreateViewModel(SpeakerService SpeakerService)
        {
            Title    = "Create speaker";
            Subtitle = "In this section you can create a new speaker.";

            this.SpeakerService = SpeakerService;
        }
Exemplo n.º 10
0
 public TalkController(TalkService talkService, SpeakerService speakerService, CityService cityService, PlaceService placeService, AuthenticationProvider authenticationProvider)
 {
     _talkService            = talkService;
     _speakerService         = speakerService;
     _cityService            = cityService;
     _placeService           = placeService;
     _authenticationProvider = authenticationProvider;
 }
Exemplo n.º 11
0
        public SpeakerTestContext()
        {
            var context    = new InMemoryDataContext();
            var repository = new Repository(context);

            _speakerService = new SpeakerService(repository);
            _unitOfWork     = context;
        }
Exemplo n.º 12
0
        //


        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;
        }
Exemplo n.º 13
0
        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();
        }
Exemplo n.º 14
0
        //
        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;
        }
Exemplo n.º 15
0
        public async Task ItGetsFeaturedSpeakers()
        {
            // Arrange
            // Act
            await Controller.GetFeatured();

            // Assert
            SpeakerService.Verify(x => x.GetFeatured(), Times.Once());
        }
Exemplo n.º 16
0
        public async Task ItGetsSpeaker()
        {
            // Arrange
            // Act
            await Controller.GetBySlug(_slug);

            // Assert
            SpeakerService.Verify(x => x.Get(_slug), Times.Once());
        }
Exemplo n.º 17
0
        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());
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 20
0
 /// <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);
 }
Exemplo n.º 21
0
        public void GivenSpeakerNotFoundThenSpeakerNotFoundException()
        {
            // Arrange
            var service = new SpeakerService(_fakeRepository, _fakeGravatarService);

            // Act
            var exception = Record.Exception(() => service.Get(-1));

            // Assert
            Assert.IsAssignableFrom <SpeakerNotFoundException>(exception);
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        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);
        }
Exemplo n.º 24
0
        public void ItAcceptsIRepository()
        {
            // Arrange
            var fakeRepository = new FakeRepository();

            // Act
            var service = new SpeakerService(fakeRepository);

            // Assert
            Assert.NotNull(service);
        }
Exemplo n.º 25
0
        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);
        }
Exemplo n.º 26
0
        public void GivenSpeakerFoundThenSpeakerDetailReturned()
        {
            // Arrange
            var speakerService = new SpeakerService(_repository, _gravatarService);

            // Act
            var speaker = speakerService.Get(1);

            // Assert
            Assert.NotNull(speaker);
            Assert.IsAssignableFrom <SpeakerDetail>(speaker);
        }
Exemplo n.º 27
0
        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);
        }
Exemplo n.º 28
0
        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);
        }
Exemplo n.º 29
0
        public void ItReturnsCollectionOfSpeakerSummary()
        {
            // Arrange
            var speakerService = new SpeakerService(_repository, _gravatarService);

            // Act
            var speakers = speakerService.GetAll();

            // Assert
            Assert.NotNull(speakers);
            Assert.IsAssignableFrom <IEnumerable <SpeakerSummary> >(speakers);
        }
Exemplo n.º 30
0
        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());
        }