public async Task GivenAnApplicant_Create_CreatesAnApplicant() { sut = new ApplicantRepo(applicationContext); var applicant = fixture.Create <Applicant>(); var createdApplicant = await sut.Create(applicant); Assert.NotNull(createdApplicant); }
public void CreateTest() { ApplicationDbContext db = new ApplicationDbContext(); // Arrange Applicant applicant = new Applicant() { ApplicantId = 1, FirstName = "Muna", LastName = "Frank", Age = 22, EmailAddress = "*****@*****.**", Gender = Gender.Female }; //Act ApplicantRepo arepo = new ApplicantRepo(); var result = arepo.Create(applicant).Result; //Assert Assert.IsTrue(result); }
public async Task GivenAnExistingApplicant_Update_UpdatesApplicant() { sut = new ApplicantRepo(applicationContext); var applicant = fixture.Create <Applicant>(); var createdApplicant = await sut.Create(applicant); var updatedApplicant = fixture.Create <Applicant>(); (var updateStatus, var updatedId) = await sut.Update(createdApplicant.Id, updatedApplicant); Assert.Equal(Result.Success, updateStatus); var updatedEntity = await sut.GetById(createdApplicant.Id); Assert.Equal(createdApplicant.Id, updatedId); Assert.Equal(updatedEntity.Address, updatedApplicant.Address); Assert.Equal(updatedEntity.Age, updatedApplicant.Age); Assert.Equal(updatedEntity.FamilyName, updatedApplicant.FamilyName); Assert.Equal(updatedEntity.Name, updatedApplicant.Name); Assert.Equal(updatedEntity.Hired, updatedApplicant.Hired); }