Пример #1
0
        public void ReturnInstanceOfQuarable_WithValidaDataIsPassed()
        {
            // Arrange
            var carAdsServices = new CarAdServices(
                this.carAdsRepoMock.Object,
                this.carBrandsRepoMock,
                this.carModelsRepoMock,
                this.carFeatureServicesMock,
                this.unitOfWorkMocked);

            // Act
            var allCarAds = carAdsServices.GetAll();

            // Assert
            Assert.IsInstanceOf <IQueryable <CarAd> >(allCarAds);
        }
Пример #2
0
        public void Call_AllMethodFromRepositoryOnce()
        {
            // Arrange
            var carAdsServices = new CarAdServices(
                this.carAdsRepoMock.Object,
                this.carBrandsRepoMock,
                this.carModelsRepoMock,
                this.carFeatureServicesMock,
                this.unitOfWorkMocked);

            // Act
            carAdsServices.GetAll();

            // Assert
            this.carAdsRepoMock.Verify(x => x.All, Times.Once);
        }
Пример #3
0
        public void ReturnQueryable_WithExactNumberOfCarAds()
        {
            // Arrange
            var carAdsServices = new CarAdServices(
                this.carAdsRepoMock.Object,
                this.carBrandsRepoMock,
                this.carModelsRepoMock,
                this.carFeatureServicesMock,
                this.unitOfWorkMocked);

            // Act
            var allCarAdsCount = carAdsServices.GetAll().Count();

            // Assert
            Assert.AreEqual(allCarAdsCount, this.carAds.Count());
        }