Beispiel #1
0
        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);
                        });
                    }
            }
        }
Beispiel #2
0
        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");
                    });
                }
            }
        }
Beispiel #3
0
 public UserRepository(GossipContext context) : base(context)
 {
 }
Beispiel #4
0
 public ChannelRepository(GossipContext context) : base(context)
 {
 }
Beispiel #5
0
 public AuthService(IOptions <EnvironmentSettings> env, GossipContext context)
 {
     this.env     = env.Value;
     this.context = context;
 }
Beispiel #6
0
 protected Repository(GossipContext context)
 {
     Context = context;
 }
 public PostsController(GossipContext context, IHttpContextAccessor httpContext)
 {
     this.context = context;
     currentUser  = httpContext.GetCurrentUser();
 }