public void AddParameter_ShouldReturn_Success() { // Arrange ParametersModel parameter = new ParametersModel { Name = "Parameter1", ProductId = 1, UnitId = 1, Value = "value1" }; fakeParametersRepository.Setup(a => a.Add(parameter)); parametersService = new ParametersService(fakeParametersRepository.Object, new Mock <ICommonRepository>().Object); ParametersDtoModel parameterDto = new ParametersDtoModel { Name = parameter.Name, ProductId = parameter.ProductId, ProductName = "Product name", UnitId = parameter.UnitId, UnitName = "Unit", Value = parameter.Value }; try { // Act parametersService.AddParameter(parameterDto); operationSucceeded = true; } catch (Exception ex) { errorMessage = ex.Message + " | " + ex.StackTrace; } // Assert Assert.IsTrue(operationSucceeded, errorMessage); }