public async Task AddPlace(string name) { // Prepare var model = new Cabinete { Name = name }; // Act var resultId = await _cabinetService.CreateAsync(model); // Assert var toGuid = Guid.TryParse(resultId, out _); toGuid.Should().BeTrue(); }
public async Task AddDuplicatePlace(string name) { // Prepare Context.Add(new Cabinete { Name = "name" }); await Context.SaveChangesAsync(); var model = new Cabinete { Name = name }; // Act Action act = () => { _cabinetService.CreateAsync(model).Wait(); }; // Assert act.Should().Throw <ApplicationException>(); }
private void SetCabinetes() { var c1 = new Cabinete { Id = Guid.NewGuid().ToString(), Name = "1" }; var c2 = new Cabinete { Id = Guid.NewGuid().ToString(), Name = "2" }; var c3 = new Cabinete { Id = Guid.NewGuid().ToString(), Name = "3" }; SchoolContext.AddRange(c1, c2, c3); SchoolContext.SaveChanges(); }