public void CreateANewPhotograph() { var dbContextScopeFactory = new DbContextScopeFactory(); var ambientDbContextLocator = new AmbientDbContextLocator(); var photographRepository = new PhotographRepository(ambientDbContextLocator); var photographService = new PhotographServices(dbContextScopeFactory, photographRepository); //var userQueryService = new UserQueryService(dbContextScopeFactory, userRepository); //var userEmailService = new UserEmailService(dbContextScopeFactory); //var userCreditScoreService = new UserCreditScoreService(dbContextScopeFactory); Photograph newPhoto = new Photograph(); newPhoto.Location = "testlocation"; Assert.IsTrue(photographService.UploadPhotography(newPhoto)); Guid uploadID = newPhoto.PhotographId; Assert.IsTrue(photographService.RemovePhotography(newPhoto)); }
public void Setup() { _dbContextScopeFactory = Substitute.For<IDbContextScopeFactory>(); _ambientDbContextLocator = Substitute.For<IAmbientDbContextLocator>(); _photographRepository = Substitute.For<IPhotographRepository>(); _dbContext = Substitute.For<IDbContextScope>(); _dbContextScopeFactory.Create().Returns(_dbContext); _photographService = new PhotographServices(_dbContextScopeFactory, _photographRepository); }
public void CreateAPhotographWitNullRepository() { //Act _photographService = new PhotographServices(_dbContextScopeFactory, null); //Assert }
public void CreateAPhotographWitNullContextScopeAndNullRepository() { //Act _photographService = new PhotographServices(null, null); //Assert }
public void GetAllPhotograph() { var dbContextScopeFactory = new DbContextScopeFactory(); var ambientDbContextLocator = new AmbientDbContextLocator(); var photographRepository = new PhotographRepository(ambientDbContextLocator); var photographService = new PhotographServices(dbContextScopeFactory, photographRepository); var photo = photographService.GetAllPhotographs(); //foreach (var photograph in photo) //{ // var tempt = photograph.Title; // foreach(var tempphot in photograph.Projects) // { // var t = tempphot.Title; // } //} Assert.IsNotNull(photo); }
public void DeletePhotograph() { CreateANewPhotograph(); var dbContextScopeFactory = new DbContextScopeFactory(); var ambientDbContextLocator = new AmbientDbContextLocator(); var photographRepository = new PhotographRepository(ambientDbContextLocator); var photographService = new PhotographServices(dbContextScopeFactory, photographRepository); //var userQueryService = new UserQueryService(dbContextScopeFactory, userRepository); //var userEmailService = new UserEmailService(dbContextScopeFactory); //var userCreditScoreService = new UserCreditScoreService(dbContextScopeFactory); Assert.IsTrue(photographService.RemovePhotography((new Photograph { PhotographId = Guid.Empty }))); }
public void GetAPhotograph() { var dbContextScopeFactory = new DbContextScopeFactory(); var ambientDbContextLocator = new AmbientDbContextLocator(); var photographRepository = new PhotographRepository(ambientDbContextLocator); var photographService = new PhotographServices(dbContextScopeFactory, photographRepository); //var userQueryService = new UserQueryService(dbContextScopeFactory, userRepository); //var userEmailService = new UserEmailService(dbContextScopeFactory); //var userCreditScoreService = new UserCreditScoreService(dbContextScopeFactory); var photo = photographService.GetPhotograph(new Guid("9a1f9e3e-b389-e511-9c5a-00249b0905d8")); foreach (var photographInProject in photo.Projects) { foreach (var actualPhoto in photographInProject.Photographs) { string a= actualPhoto.Title; } } var photo2 = photographService.GetPhotograph(new Guid("1a1f9e3e-b389-e511-9c5a-00249b0905d8")); Assert.IsNotNull(photo); }