| }, 1)); | }, 1)); | ||||
| } | } | ||||
| //[Fact] | |||||
| //public async Task UpdatePattern_ShouldUpdatePattern_WhenConditionsAreFullfiled() | |||||
| //{ | |||||
| // _selectionLevelService.GetByIdEntity(Arg.Any<int>()).Returns(new SelectionLevel | |||||
| // { | |||||
| // Id = 1122, | |||||
| // Name = "Test 1", | |||||
| // SelectionProcesses = new List<SelectionProcess>() | |||||
| // }); | |||||
| // var databaseContext = await Helpers<Pattern>.GetDatabaseContext(_patterns); | |||||
| // PatternService patternService = new(databaseContext, _mapper, _selectionLevelService, _logger, _emailService, _selectionProcessService); | |||||
| // var updatePatternDto = new PatternUpdateDto | |||||
| // { | |||||
| // CreatedAt = DateTime.Now, | |||||
| // Message = "Message", | |||||
| // SelectionLevelId = 1122, | |||||
| // Title = "Zakazan termin" | |||||
| // }; | |||||
| // await patternService.UpdateAsync(updatePatternDto, 1); | |||||
| // var result = await patternService.GetAllAsync(); | |||||
| // Assert.Equal(1, result.Count); | |||||
| //} | |||||
| [Fact] | |||||
| public async Task UpdatePattern_ShouldUpdatePattern_WhenConditionsAreFullfiled() | |||||
| { | |||||
| _selectionLevelService.GetByIdEntity(Arg.Any<int>()).Returns(new SelectionLevel | |||||
| { | |||||
| Id = 1, | |||||
| Name = "Test 1", | |||||
| SelectionProcesses = new List<SelectionProcess>() | |||||
| }); | |||||
| var databaseContext = await Helpers<Pattern>.GetDatabaseContext(_patterns); | |||||
| PatternService patternService = new(databaseContext, _mapper, _selectionLevelService, _logger, _emailService, _selectionProcessService); | |||||
| var updatePatternDto = new PatternUpdateDto | |||||
| { | |||||
| CreatedAt = DateTime.Now, | |||||
| Message = "Message", | |||||
| SelectionLevelId = 1122, | |||||
| Title = "Zakazan termin" | |||||
| }; | |||||
| await patternService.UpdateAsync(updatePatternDto, 1); | |||||
| var result = await patternService.GetAllAsync(); | |||||
| Assert.Equal(1, result.Count); | |||||
| } | |||||
| [Fact] | [Fact] | ||||
| public async Task DeletePattern_ShouldThrowEntityNotFoundException_WhenPatternDoesNotExist() | public async Task DeletePattern_ShouldThrowEntityNotFoundException_WhenPatternDoesNotExist() |