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

            // Act
            carAdsServices.GetLastFiveAddedAds();

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

            // Act
            var allLatestCarAds = carAdsServices.GetLastFiveAddedAds();

            // Assert
            Assert.IsInstanceOf <IQueryable <CarAd> >(allLatestCarAds);
        }
コード例 #3
0
        public void ReturnQueryable_WithExactlyFourOfCarAds()
        {
            // Arrange
            var carAdsServices = new CarAdServices(
                this.carAdsRepoMock.Object,
                this.carBrandsRepoMock,
                this.carModelsRepoMock,
                this.carFeatureServicesMock,
                this.unitOfWorkMocked);

            // Act
            var exactlyFourCarAdsResult = carAdsServices.GetLastFiveAddedAds().Count();

            // Assert
            Assert.AreEqual(4, exactlyFourCarAdsResult);
        }