Ejemplo n.º 1
0
        public async Task EditDestination_ShouldEditDestinationCorrectly()
        {
            var destRepoBuilder = new DestinationsRepositoryBuilder();
            var destRepo        = destRepoBuilder
                                  .WithAll()
                                  .Build();

            var sut = new DestinationService(destRepo, null, null, null, null, null, null, Mapper);

            var editDestinationViewModel = new EditDestinationViewModel
            {
                Id            = "2",
                Image         = SetupFileMock().Object,
                Description   = "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
                Level         = (LevelOfDifficulty)2,
                Naame         = "Niki",
                StartDate     = DateTime.Now.AddDays(3),
                EndDateToJoin = DateTime.Now.AddDays(1),
                EndDate       = DateTime.Now.AddDays(5)
            };


            await sut.EditDestination(editDestinationViewModel);

            var newdest = destRepo.All().FirstOrDefault(x => x.Id == "2");

            var actual = Mapper.Map <EditDestinationViewModel>(newdest);

            Assert.Equal(editDestinationViewModel, actual, new EditDestinationViewModelComparer());
        }