示例#1
0
        public void Test_CreateGame_Game_PlatformType_Is_Null()
        {
            //arrange
            GameService servise = new GameService(_unitOfWork.Object, null);
            GameDTO game = new GameDTO()
            {
                Key = "key",
                Description = "Description",
                Name = "Name",
                Genres = genres.Object.GetAll().Take(1).Select(Mapper.Map<Genre, GenreDTO>),
                PlatformTypes = null
            };

            //act
            servise.CreateGame(game);
        }
示例#2
0
        public void Test_CreateGame_Game_PlatformTypes_Has_PlatfromType_With_Id_Less_Zero()
        {
            //arrange
            GameService servise = new GameService(_unitOfWork.Object, null);
            GameDTO game = new GameDTO()
            {
                Key = "key",
                Description = "Description",
                Name = "Name",
                Genres = new List<GenreDTO>() { new GenreDTO() { GenreId = 1, Name = "Name" } },
                PlatformTypes = new List<PlatformTypeDTO>() { new PlatformTypeDTO() { PlatformTypeId = -1, Name = "Name" } }
            };

            //act
            servise.CreateGame(game);
        }
示例#3
0
        public void Test_CreateGame_Game_Genres_Has_Genre_With_Id_Less_Zero()
        {
            //arrange
            GameService servise = new GameService(_unitOfWork.Object, null);
            GameDTO game = new GameDTO()
            {
                Key = "key",
                Description = "Description",
                Name = "Name",
                Genres = new List<GenreDTO>() { new GenreDTO() { GenreId = -1, Name = "Name" } },
                PlatformTypes = platformTypes.Object.GetAll().Take(1).Select(Mapper.Map<PlatformType, PlatformTypeDTO>)
            };

            //act
            servise.CreateGame(game);
        }
示例#4
0
        public void Test_CreateGame_Game_Is_Null()
        {
            //arrange
            GameService servise = new GameService(_unitOfWork.Object, null);
            GameDTO game = null;

            //act
            servise.CreateGame(game);
        }
示例#5
0
        public void Test_CreateGame_Call_Insert()
        {
            //arrange
            GameService servise = new GameService(_unitOfWork.Object, null);
            GameDTO game = new GameDTO()
            {
                Key = "key",
                Description = "Description",
                Name = "Name",
                Genres = genres.Object.GetAll().Take(1).Select(Mapper.Map<Genre, GenreDTO>),
                PlatformTypes = platformTypes.Object.GetAll().Take(1).Select(Mapper.Map<PlatformType, PlatformTypeDTO>),
                Publisher = new PublisherDTO() { CompanyName = "name", PublisherId = 1, Description = "description", HomePage = "home.page"},
                Price = 1,
                Discontinued = false,
                UnitsInStock = 20
            };

            //act
            servise.CreateGame(game);

            //assert
               games.Verify(g => g.Insert(It.IsAny<Game>()), Times.Once());
        }