public async void AddAndVerifyChannels() { // Arrange using (var scope = _container.BeginLifetimeScope()) { var mediator = scope.Resolve <IMediator>(); using (var ctx = new GossipContext()) using (var uow = await new UnitOfWorkFactory <GossipContext>(ctx, mediator).CreateAsync()) { var channelRepo = new ChannelRepository(ctx); ctx.Channels.RemoveRange(ctx.Channels); // Act channelRepo.InsertChannel(new Channel(name: "abc", description: "def")); await uow.CommitChangesAsync(); var channels = await channelRepo.GetAllChannels(); // Assert Assert.Collection(channels, p => { Assert.Equal("abc", p.Name); Assert.Equal("def", p.Description); }); } } }
public async void AddAndVerifyChannels() { // Arrange using (var scope = _container.BeginLifetimeScope()) { var mediator = scope.Resolve <IMediator>(); using (var ctx = new GossipContext(mediator)) { var channelRepo = new ChannelRepository(ctx); ctx.Channels.RemoveRange(ctx.Channels); // Act channelRepo.InsertChannel(new Channel(name: "abc", description: "def")); await channelRepo.UnitOfWork.SaveEntitiesAsync(); var channels = await channelRepo.GetAllChannels(); // Assert Assert.Collection(channels, p => { Assert.Equal(p.Name, "abc"); Assert.Equal(p.Description, "def"); }); } } }
public UserRepository(GossipContext context) : base(context) { }
public ChannelRepository(GossipContext context) : base(context) { }
public AuthService(IOptions <EnvironmentSettings> env, GossipContext context) { this.env = env.Value; this.context = context; }
protected Repository(GossipContext context) { Context = context; }
public PostsController(GossipContext context, IHttpContextAccessor httpContext) { this.context = context; currentUser = httpContext.GetCurrentUser(); }