Esempio n. 1
0
        public void AddNewGame_GameWithUniqueKey_CreateCalled()
        {
            var fakeGameDTO = new ExtendGameDTO()
            {
                Id = Guid.NewGuid(), Key = "qweqwe", NameEn = "1", DescriptionEn = "2"
            };
            var fakeGame = _mapper.Map <Game>(fakeGameDTO);

            _uow.Setup(uow => uow.Games.Get(It.IsAny <Func <Game, bool> >())).Returns(new List <Game>());
            _uow.Setup(uow => uow.Genres.Get(It.IsAny <Func <Genre, bool> >())).Returns(new List <Genre>());
            _uow.Setup(uow => uow.PlatformTypes.Get(It.IsAny <Func <PlatformType, bool> >())).Returns(new List <PlatformType>());

            _uow.Setup(uow => uow.Games.Create(fakeGame));

            _sut.AddNew(fakeGameDTO);

            _uow.Verify(uow => uow.Games.Create(It.IsAny <Game>()), Times.Once);
        }