public void SetUp() { this.libraryContextMock = EntityFrameworkMock.Create <LibraryDbContext>(); EntityFrameworkMock.PrepareMock(this.libraryContextMock); this.userReviewService = new UserReviewService(new UserReviewRepository(this.libraryContextMock)); this.auctionUserService = new AuctionUserService(new AuctionUserRepository(this.libraryContextMock), this.userReviewService); }
public void SetUp() { this.libraryContextMock = EntityFrameworkMock.Create <LibraryDbContext>(); EntityFrameworkMock.PrepareMock(this.libraryContextMock); this.categoryService = new CategoryService(new CategoryRepository(this.libraryContextMock)); this.productService = new ProductService(new ProductRepository(this.libraryContextMock)); }
public void GivenPatientWhenRegisteringThenPersistToDb() { HospitalManagementSystemContext HospitalManagementSystemContext = EntityFrameworkMock.Create <HospitalManagementSystemContext>(); TypeFactory.RegisterInstance(HospitalManagementSystemContext); Patient patient = new Patient(); patient.PersonId = 1; patient.Person.Id = 1; patient.Person.FirstName = "Vusi"; patient.Person.Surname = "Khoza"; patient.Person.IdNumber = "1234"; IPatientRepository patientRepository = new PatientRepository(); IPatientRegistration patientRegistration = new PatientRegistration(patientRepository); patientRegistration.Register(patient); IPatientRetriever patientRetriever = new PatientRetriever(patientRepository); patientRetriever.Retrieve(patient.Person.IdNumber); Assert.IsNotNull(patientRetriever.Patient); Assert.AreEqual(patient.Person.Id, patientRetriever.Patient.Person.Id); Assert.AreEqual(patient.Person.FirstName, patientRetriever.Patient.Person.FirstName); Assert.AreEqual(patient.Person.Surname, patientRetriever.Patient.Person.Surname); }
public void SetUp() { this.libraryContextMock = EntityFrameworkMock.Create <LibraryDbContext>().PrepareMock(); this.productService = new ProductService(new ProductRepository(this.libraryContextMock)); this.priceService = new PriceService(new PriceRepository(this.libraryContextMock)); this.userReviewService = new UserReviewService(new UserReviewRepository(this.libraryContextMock)); this.auctionUserService = new AuctionUserService(new AuctionUserRepository(this.libraryContextMock), this.userReviewService); this.categoryService = new CategoryService(new CategoryRepository(this.libraryContextMock)); this.auctionService = new AuctionService(new AuctionRepository(this.libraryContextMock), this.categoryService, this.auctionUserService); this.bidService = new BidService(new BidRepository(this.libraryContextMock), this.auctionService); }
public void SetUp() { this.category = new Category { CategoryName = "Electronics" }; this.auctionDbMock = EntityFrameworkMock.Create <AuctionDb>(); EntityFrameworkMock.PrepareMock(this.auctionDbMock); this.productService = new ProductService( new ProductRepository(this.auctionDbMock), new CategoriesService(new CategoriesRepository(this.auctionDbMock))); }
public void SetUp() { this.auctionDbMock = EntityFrameworkMock.Create <AuctionDb>(); EntityFrameworkMock.PrepareMock(this.auctionDbMock); this.reviewService = new ReviewService(new ReviewRepository(this.auctionDbMock)); this.fromUser = new User { Id = 1, FirstName = "Dan", LastName = "Brown" }; this.toUser = new User { Id = 2, FirstName = "Mihai", LastName = "Anghel" }; }
public void SavingAReview_WhenSuccessful_CallsContextSaveChanges() { //Arrange var mockContext = EntityFrameworkMock.Create <IFruitFinderContext>(); Mock.Arrange(() => mockContext.SaveChanges()).OccursOnce(); var builder = new FruitFinderDalBuilder().WithContext(mockContext); var dal = builder.Build(); var review = builder.MakeReview(); //Act dal.SaveReview(review); //Assert Mock.Assert(mockContext); }
public void SetUp() { this.auctionDbMock = EntityFrameworkMock.Create <AuctionDb>(); EntityFrameworkMock.PrepareMock(this.auctionDbMock); this.bidService = new BidService(new BidRepository(this.auctionDbMock)); this.price = new Price { ThePrice = 150, Currency = "USD" }; this.user = new User { Id = 1, FirstName = "Dan", LastName = "Brown" }; this.bid = new Bid(); this.bid.User = this.user; this.bid.Price = this.price; }
public void SetUp() { this.auctionDbMock = EntityFrameworkMock.Create <AuctionDb>(); this.reviewService = new ReviewService(new ReviewRepository(this.auctionDbMock)); this.userService = new UserService(new UserRepository(this.auctionDbMock), new ReviewRepository(this.auctionDbMock)); this.user = new User(); this.user.FirstName = "Mihai"; this.user.LastName = "Dan"; this.user.Gender = "M"; this.user.Email = "*****@*****.**"; this.user.Address = "brasov"; this.user.PhoneNumber = "1234567891"; this.user.Id = 1; var fromUser = new User { Id = 1, FirstName = "Dan", LastName = "Brown" }; var review = new Review { FromUser = fromUser, ToUser = this.user, Score = 5.0 }; var result = this.reviewService.AddReview(review); }
public void Prepare_Interface_DbSetsInitialized() { var dbContext = EntityFrameworkMock.Create <IMyDbContext>(); Assert.IsNotNull(dbContext.People); }
public void Have_An_Empty_Authors_List_When_Context_Has_No_Authors() { var target = new BlogPostEditViewModel(new BlogPost(), EntityFrameworkMock.Create <BlogContext>()); target.Authors.ShouldBeEmpty(); }
public void SetUp() { this.auctionDbMock = EntityFrameworkMock.Create <AuctionDb>(); EntityFrameworkMock.PrepareMock(this.auctionDbMock); this.priceService = new PriceService(new PriceRepository(this.auctionDbMock)); }
public void SetUp() { this._auctionDbMock = EntityFrameworkMock.Create <AuctionDb>(); this._categoriesService = new CategoriesService(new CategoriesRepository(this._auctionDbMock)); }