public async Task GetAllCowsAsync() { await DataBaseHelper.ClearDatabaseAsync(); var newFirstCow = new CreateCowCommand { FarmId = Guid.NewGuid(), State = CowState.Open }; var newSecondCow = new CreateCowCommand { FarmId = Guid.NewGuid(), State = CowState.Pregnant }; var firstCow = CowsApi.ApiV1CowsPost(newFirstCow); var secondCow = CowsApi.ApiV1CowsPost(newSecondCow); var result = CowsApi.ApiV1CowsGet(); Assert.Equal(2, result.Count); Assert.Equal(firstCow.Id, result[0].Id); Assert.Equal(firstCow.FarmId, result[0].FarmId); Assert.Equal(firstCow.State, result[0].State); Assert.Equal(secondCow.Id, result[1].Id); Assert.Equal(secondCow.FarmId, result[1].FarmId); Assert.Equal(secondCow.State, result[1].State); }
public void CreateCow() { var newCow = new CreateCowCommand { FarmId = Guid.NewGuid(), State = CowState.Open }; var cow = CowsApi.ApiV1CowsPost(newCow); Assert.Equal(newCow.FarmId, cow.FarmId); Assert.Equal(newCow.State, cow.State); Assert.NotEqual(Guid.Empty, cow.Id); }
public void GetCow() { var newCow = new CreateCowCommand { FarmId = Guid.NewGuid(), State = CowState.Pregnant }; var cow = CowsApi.ApiV1CowsPost(newCow); var result = CowsApi.ApiV1CowsIdGet(cow.Id); Assert.Equal(newCow.FarmId, cow.FarmId); Assert.Equal(newCow.State, cow.State); Assert.Equal(cow.FarmId, result.FarmId); Assert.Equal(cow.State, result.State); Assert.Equal(cow.Id, result.Id); }
public void DeleteCow() { var newCow = new CreateCowCommand { FarmId = Guid.NewGuid(), State = CowState.Inseminated }; var cow = CowsApi.ApiV1CowsPost(newCow); var result = CowsApi.ApiV1CowsIdGet(cow.Id); Assert.Equal(newCow.FarmId, cow.FarmId); Assert.Equal(newCow.State, cow.State); Assert.Equal(cow.FarmId, result.FarmId); Assert.Equal(cow.State, result.State); Assert.Equal(cow.Id, result.Id); CowsApi.ApiV1CowsIdDelete(cow.Id); result = CowsApi.ApiV1CowsIdGet(cow.Id); Assert.Null(result); }