public TeamReadRepository(IPersistenceContext persistenceContext,
                                  ITeamOdataProvider teamOdataProvider)
        {
            if (persistenceContext == null)
            {
                throw Error.ArgumentNull(nameof(persistenceContext));
            }
            _teamOdataProvider = teamOdataProvider ?? throw Error.ArgumentNull(nameof(teamOdataProvider));

            _collection = persistenceContext.Database.GetCollection <TeamClass>(Consts.Collections.Teams);
        }
Exemple #2
0
        public void CtorShouldFailWhenTeamOdataProviderNull()
        {
            // Arrange
            var persistenceConfiguration           = new PersistenceConfiguration("mongodb://*****:*****@localhost:10255/admin?ssl=true");
            IPersistenceContext persistenceContext = new PersistenceContext(persistenceConfiguration);
            ITeamOdataProvider  odataProvider      = null;

            // Act
            Action ctor = () => { new TeamReadRepository(persistenceContext, odataProvider); };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }