public PharmacyServiceTests() { sut = new Services.Services.PharmacyService(pharmacyRepositoryMock.Object); var pharmacies = PharmacyFactory.GetPharmacies(); pharmacyRepositoryMock.Setup(x => x.GetAll()).Returns(pharmacies); }
public void Given_GetAll_Then_ShouldReturnAllPharmacies() { //Arrange var expectedResult = PharmacyFactory.GetPharmacies(); //Act var result = sut.GetAll(); //Assert pharmacyRepositoryMock.Verify(x => x.GetAll(), Times.Once); result.Should().HaveCount(expectedResult.Count()); }
public void Given_Delete_When_IdIsValid_Then_ShouldReturnSuccess() { //Arrange var pharmacy = PharmacyFactory.GetPharmacy(); pharmacyRepositoryMock.Setup(x => x.GetById(It.IsAny <Guid>())).Returns(pharmacy); //Act var result = sut.Delete(pharmacy.Id); //Assert result.IsSuccess.Should().BeTrue(); }
public void Given_Create_When_ModelIsValid_Then_ShouldReturnSuccess() { //Arrange var pharmacy = PharmacyFactory.GetPharmacy().ToModel(); pharmacyRepositoryMock.Setup(x => x.Create(It.IsAny <Pharmacy>())); //Act var result = sut.Create(pharmacy); //Assert result.IsSuccess.Should().BeTrue(); }
public void Given_GetById_When_APharmacyIdIsPassed_Then_ShouldReturnThePharmacy() { //Arrange var expected = PharmacyFactory.GetPharmacy(); pharmacyRepositoryMock.Setup(x => x.GetById(It.IsAny <Guid>())).Returns(expected); //Act var result = sut.GetById(expected.Id); //Assert pharmacyRepositoryMock.Verify(x => x.GetById(It.IsAny <Guid>()), Times.Once); result.Value.Should().BeEquivalentTo(expected.ToModel()); }