Example #1
0
        public void Call_AllMethodFromRepositoryOnce()
        {
            // Arrange
            var carAdsServices = new CarAdServices(
                this.carAdsRepoMock.Object,
                this.carBrandsRepoMock,
                this.carModelsRepoMock,
                this.carFeatureServicesMock,
                this.unitOfWorkMocked);

            // Act
            carAdsServices.GetAdById(It.IsAny <Guid>());

            // Assert
            this.carAdsRepoMock.Verify(x => x.All, Times.Once);
        }
Example #2
0
        public void ReturnCarAd_WithExactSameId()
        {
            // Arrange
            var carAdsServices = new CarAdServices(
                this.carAdsRepoMock.Object,
                this.carBrandsRepoMock,
                this.carModelsRepoMock,
                this.carFeatureServicesMock,
                this.unitOfWorkMocked);

            // Act
            var actualReturnedCarAd = carAdsServices.GetAdById(this.expectedCarAd.Id);

            // Assert
            Assert.AreSame(this.expectedCarAd, actualReturnedCarAd);
        }