Ejemplo n.º 1
0
        public async Task GetByName_WithInvalidInput_ShouldReturnInvalidResult(string name)
        {
            var dbContext = ApplicationDbContextCreatorInMemory.InitializeContext();

            await this.SeedData(dbContext);

            var actorsRepository = new EfDeletableEntityRepository <Actor>(dbContext);

            var service = new ActorsService(actorsRepository);

            var result = service.GetByTitle <ActorViewModel>(name);

            Assert.Null(service.GetByTitle <ActorViewModel>(name));
        }
Ejemplo n.º 2
0
        public async Task Create_WithValidInput_ShouldReturnValidResult()
        {
            var dbContext = ApplicationDbContextCreatorInMemory.InitializeContext();

            var actorsRepository = new EfDeletableEntityRepository <Actor>(dbContext);

            var service = new ActorsService(actorsRepository);

            var input = new ActorCreateModel()
            {
                FirstName = "Bob",
                LastName  = "Ross",
                Gender    = "Male",
            };

            var actor  = service.Create(input);
            var result = service.GetByTitle <ActorViewModel>("Bob");

            Assert.Equal("Ross", result.LastName);
            Assert.Equal("Male", result.Gender);
        }