예제 #1
0
        public async Task GetAllTest()
        {
            var studios = new List <Studio>
            {
                new Studio()
                {
                    Name = "Studio One"
                },
                new Studio()
                {
                    Name = "Studio Two"
                }
            };

            var fakeRepositoryMock = new Mock <IStudioRepository>();

            fakeRepositoryMock.Setup(x => x.GetAll()).ReturnsAsync(studios);

            var studioService = new StudioService(fakeRepositoryMock.Object);

            var resultStudios = await studioService.GetStudios();

            Assert.Collection(resultStudios, studio =>
            {
                Assert.Equal("Studio One", studio.Name);
            },
                              studio =>
            {
                Assert.Equal("Studio Two", studio.Name);
            });
        }
 public async Task <IActionResult> Create()
 {
     ViewData["DirectorId"] = new SelectList(await _directorService.GetDirectors(), "DirectorId", "Name");
     ViewData["StudioId"]   = new SelectList(await _studioService.GetStudios(), "StudioId", "Name");
     return(View());
 }
 public async Task <IActionResult> Index()
 {
     return(View(await _studioService.GetStudios()));
 }