public async void RenameDataModel_ValidItem() { var projectDataModelService = new ProjectDataModelService(_dataModelRepository.Object, _propertyRepository.Object, _projectRepository.Object); await projectDataModelService.UpdateDataModel(new ProjectDataModel { Id = 1, Name = "newName" }); var dataModel = _data.First(d => d.Id == 1); Assert.Equal("newName", dataModel.Name); }
public void RenameDataModel_DuplicateItem() { _data.Add(new ProjectDataModel { Id = 2, ProjectId = 1, Name = "newName" }); var projectDataModelService = new ProjectDataModelService(_dataModelRepository.Object, _propertyRepository.Object, _projectRepository.Object); var exception = Record.ExceptionAsync(() => projectDataModelService.UpdateDataModel(new ProjectDataModel { Id = 1, Name = "newName" })); Assert.IsType <DuplicateProjectDataModelException>(exception?.Result); }