public async void CreateWithInvalidData_Throws() { //Arrange var explorersTeam = new ExplorersTeam { Id = Guid.NewGuid(), Name = "Test" }; m_explorersTeamRepositoryMock.Setup(t => t.SearchAsync(It.IsAny <Pagination>(), It.IsAny <Ordering>(), It.IsAny <ExplorersTeamFilter>())) .ReturnsAsync(new Tuple <int, List <ExplorersTeam> >(1, new List <ExplorersTeam> { explorersTeam })); //Act var invalidData = m_robotService.CreateRobotAsync(new Robot { Id = Guid.NewGuid(), Name = "Test", ExplorersTeamId = explorersTeam.Id, ProductNumber = "123A" }); //Assert await Assert.ThrowsAsync <ValidationException>(async() => await invalidData); m_repositoryMock.Verify(t => t.CreateAsync(It.IsAny <Robot>()), Times.Never); }