Правки по ПР.Тесты

This commit is contained in:
Lyudmila Romanova 2022-05-25 20:58:56 +05:00
parent fa4d113221
commit 0d381dca78

View File

@ -70,30 +70,15 @@ namespace AsbCloudWebApi.Tests.ServicesTests
public async Task UpdateAsync_not_add_if_exists()
{
///Добавляем элемент
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
context.Drillers.Add(driller);
var oldCount = (await service.GetAllAsync(CancellationToken.None)).Count();
//Обновляем
drillerObj.Id = id;
drillerObj.Id = driller.Id;
drillerObj.Name = "Исправлено";
await service.UpdateAsync(id, drillerObj, CancellationToken.None);
await service.UpdateAsync(driller.Id, drillerObj, CancellationToken.None);
var newCount = (await service.GetAllAsync(CancellationToken.None)).Count();
Assert.Equal(newCount, oldCount);
}
[Fact]
public async Task DeleteAsync_decrement_count()
{
///Добавляем элемент
var id = await service.InsertAsync(drillerObj, CancellationToken.None);
var oldCount = (await service.GetAllAsync(CancellationToken.None)).Count();
//Удаляем его
await service.DeleteAsync(id, CancellationToken.None);
var newCount = (await service.GetAllAsync(CancellationToken.None)).Count();
Assert.Equal(newCount, oldCount-1);
}
}
}