Exemplo n.º 1
0
        public void Service_Can_Create_Advertisement()
        {
            // ARRANGE
            var entity = new Business.Entities.Advertisement
            {
                BookingDateTimeUtc = DateTime.UtcNow.AddDays(1),
                ClientName         = "Test",
                DurationSeconds    = 60
            };

            // ACT
            _service.AddAdvertisement(entity);

            // ASSERT
        }
Exemplo n.º 2
0
        public async void AddAdPositive()
        {
            // Arrange
            var regionRepository = new Mock <IRepository <Region> >();

            regionRepository.Setup(u => u.GetAsync(It.IsAny <int>()))
            .ReturnsAsync(new Region()).Verifiable();

            var systemReposiotry = new Mock <ISystemRepository>();

            systemReposiotry.Setup(u => u.GetAsync(It.IsAny <int>()))
            .ReturnsAsync(new Games4TradeAPI.Models.System()).Verifiable();

            var genreRepository = new Mock <IGenreRepository>();

            genreRepository.Setup(u => u.GetAsync(It.IsAny <int>()))
            .ReturnsAsync(new Genre()).Verifiable();

            var stateRepository = new Mock <IRepository <State> >();

            stateRepository.Setup(u => u.GetAsync(It.IsAny <int>()))
            .ReturnsAsync(new State()).Verifiable();

            var advertisementRepository     = new Mock <IAdvertisementReposiotry>();
            var advertisementItemRepository = new Mock <IRepository <AdvertisementItem> >();

            advertisementRepository
            .Setup(u => u.AddAsync(It.IsAny <Advertisement>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            advertisementItemRepository
            .Setup(u => u.AddAsync(It.IsAny <Game>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            var service = new AdvertisementService(advertisementRepository.Object, null, null, stateRepository.Object, genreRepository.Object, regionRepository.Object, systemReposiotry.Object, advertisementItemRepository.Object, _fixture.Mapper);
            var newAdd  = new AdvertisementSaveDto
            {
                GenreId        = 1,
                RegionId       = 2,
                SystemId       = 3,
                StateId        = 4,
                Discriminator  = "Game",
                Title          = "Test of Add",
                Description    = "Test of Add",
                ExchangeActive = true,
                Price          = 10
            };


            // Act
            await service.AddAdvertisement(userId : 1, ad : newAdd);

            // Assert todo
            //advertisementRepository.Verify();
            //advertisementItemRepository.Verify();
        }
Exemplo n.º 3
0
 public void AddAdvertisement(Advertisement value)
 {            
     _service.AddAdvertisement(value);
 }