public ConferenceService(ConferenceRepository confRepo, AddressRepository addressRepo, UserRepository userRepo, SlotRepository slotRepo)
 {
     _confRepo    = confRepo;
     _addressRepo = addressRepo;
     _userRepo    = userRepo;
     _slotRepo    = slotRepo;
 }
Example #2
0
        static void Main()
        {
            CreateDatabase       db             = new CreateDatabase();
            UserRepository       userRepo       = new UserRepository();
            ConferenceRepository conferenceRepo = new ConferenceRepository();
            EditionRepository    editionRepo    = new EditionRepository();

            BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();

            serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();

            IDictionary props = new Hashtable();

            props["port"] = 55555;

            TcpChannel channel = new TcpChannel(props, clientProv, serverProv);

            ChannelServices.RegisterChannel(channel, false);

            var server = new ServerImpl();

            RemotingServices.Marshal(server, "Chat");

            Console.WriteLine("Server started ...");
            Console.WriteLine("Press <enter> to exit...");
            Console.ReadLine();
        }
Example #3
0
        public void AddConferences()
        {
            // Arrange
            var repository = new ConferenceRepository();

            var dbContext   = A.Fake <ProFootballEntities>();
            var conferences = new List <Conference>();

            for (int i = 1; i <= 3; i++)
            {
                var conference = new Conference
                {
                    Name = "Conference " + i
                };
                conferences.Add(conference);
            }
            A.CallTo(() => dbContext.Conferences.AddRange(A <IEnumerable <Conference> > .Ignored)).Returns(conferences);

            // Act
            var result = repository.AddEntities(dbContext, conferences);

            // Assert
            A.CallTo(() => dbContext.Conferences.AddRange(conferences)).MustHaveHappenedOnceExactly();
            Assert.AreSame(conferences, result);
        }
Example #4
0
 public ConferenceService(ConferenceRepository conferRepository, ListenerConfRepository listenerRepository,
                          ReportConferenceRepository reportRepository)
 {
     _conferRepository   = conferRepository;
     _listenerRepository = listenerRepository;
     _reportRepository   = reportRepository;
 }
 public CachedConferenceRepository(ConferenceRepository conferenceRepository,
     ILogger<CachedConferenceRepository> logger,
     Cacher cacher)
 {
     _underlyingRepository = conferenceRepository;
     _logger = logger;
     _cacher = cacher;
 }
Example #6
0
        //[TestCase]
        public void TestCase1()
        {
            // Arrange
            var repository = new ConferenceRepository();

            // Act

            // Assert
        }
        public ConferenceRepositoryTests()
        {
            DbContextOptions <ConferenceDbContext> options = new DbContextOptionsBuilder <ConferenceDbContext>()
                                                             .UseInMemoryDatabase(databaseName: "ConferenceDb")
                                                             .Options;

            var conferenceDbContext = new ConferenceDbContext(options);

            conferenceRepository = new ConferenceRepository(conferenceDbContext);
        }
Example #8
0
 public ServerImpl()
 {
     conferenceRepository = new ConferenceRepository();
     editionRepository    = new EditionRepository();
     paperRepo            = new PaperRepository();
     bidRepo      = new BidRepository();
     userRepo     = new UserRepository();
     reviewRepo   = new ReviewRepository();
     reviewerRepo = new ReviewerRepository();
 }
        public void Should_get_events_by_name()
        {
            var conference = new Conference("Foo");

            SaveEntities(conference);

            var repos = new ConferenceRepository(SessionSource.CreateSession());

            var loaded = repos.GetByName("Foo");

            loaded.ShouldEqual(conference);
        }
Example #10
0
        public void Should_get_events_by_name()
        {
            var conference = new Conference("Foo");

            SaveEntities(conference);

            var repos = new ConferenceRepository(SessionSource.CreateSession());

            var loaded = repos.GetByName("Foo");

            loaded.ShouldEqual(conference);
        }
 public PhaseOneController(
     ProposalRepository proposalRepository,
     UserRepository userRepository,
     ConferenceRepository conferenceRepository,
     RoleRepository roleRepository
     )
 {
     this.proposalRepository   = proposalRepository;
     this.userRepository       = userRepository;
     this.conferenceRepository = conferenceRepository;
     this.roleRepository       = roleRepository;
 }
        public void GetConferences_HappyPath()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            // Act
            var result = repository.GetEntities();

            // Assert
            Assert.IsInstanceOf <IEnumerable <Conference> >(result);
        }
        public void EditConference_ExceptionCaught_LogsAndRethrowsException()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            var conference = new Conference();

            A.CallTo(() => dbContext.SetModified(A <Conference> .Ignored)).Throws <Exception>();

            // Act & Assert
            Assert.Throws <Exception>(() => repository.EditEntity(conference));
        }
        public void EditConference_HappyPath()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            var conference = new Conference();

            // Act
            repository.EditEntity(conference);

            // Assert
            A.CallTo(() => dbContext.SetModified(conference)).MustHaveHappenedOnceExactly();
        }
Example #15
0
        public async Task GetConferencesAsync()
        {
            // Arrange
            var repository = new ConferenceRepository();

            var dbContext = A.Fake <ProFootballEntities>();

            dbContext.SetUpFakeConferencesAsync();

            // Act
            var result = await repository.GetEntitiesAsync(dbContext);

            // Assert
            Assert.IsInstanceOf <IEnumerable <Conference> >(result);
        }
 public void Initialize()
 {
     conferenceRepository = ApplicationFactory.getConferenceRepository();
     phaseRepository      = ApplicationFactory.getPhaseRepository();
     conference           = new Conference();
     newConference        = new Conference();
     phase = new Phase();
     conference.ConferenceFee = 150;
     conference.Name          = "Test";
     conference.StartDate     = DateTime.Now;
     phase.Name                  = "Test";
     conference.ActivePhase      = phase;
     newConference.Name          = "Before";
     newConference.ConferenceFee = 100;
 }
        public void CreateConference_HappyPath()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            A.CallTo(() => dbContext.Conferences.Create()).Returns(new Conference());

            // Act
            var result = repository.CreateEntity();

            // Assert
            A.CallTo(() => dbContext.Conferences.Create()).MustHaveHappenedOnceExactly();
            Assert.IsInstanceOf <Conference>(result);
        }
        public void CreateConference_ExceptionCaught_LogsAndRethrowsException()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            A.CallTo(() => dbContext.Conferences.Create()).Throws <Exception>();

            // Act
            Conference result = null;

            Assert.Throws <Exception>(() => result = repository.CreateEntity());

            // Assert
            Assert.IsNull(result);
        }
        //[TestCase]
        public void TestCase1()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            // TODO: Define argument variables of method under test.

            // TODO: Set up needed infrastructure of class under test.

            // Act
            // TODO: Call method under test.

            // Assert
            // TODO: Assert results of call to method under test.
        }
 public PhaseTwoController(
     ReviewRepository reviewRepo,
     ProposalRepository proposalRepo,
     UserRepository userRepo,
     ConferenceRepository conferenceRepository,
     UserRoleRepository userRoleRepo,
     RoleRepository roleRepository
     )
 {
     this.reviewRepo           = reviewRepo;
     this.proposalRepo         = proposalRepo;
     this.userRepo             = userRepo;
     this.conferenceRepository = conferenceRepository;
     this.userRoleRepo         = userRoleRepo;
     this.roleRepository       = roleRepository;
 }
        public void GetConferences_ExceptionCaught_LogsAndRethrowsException()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            A.CallTo(() => dbContext.Conferences).Throws <Exception>();

            // Act
            IEnumerable <Conference> result = null;

            Assert.Throws <Exception>(() => result = repository.GetEntities());

            // Assert
            Assert.IsNull(result);
        }
        public void RemoveConference_HappyPath()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            var conference = new Conference();

            A.CallTo(() => dbContext.Conferences.Remove(A <Conference> .Ignored)).Returns(conference);

            // Act
            var result = repository.RemoveEntity(conference);

            // Assert
            A.CallTo(() => dbContext.Conferences.Remove(conference)).MustHaveHappenedOnceExactly();
            Assert.AreSame(conference, result);
        }
        public void AddConferences_HappyPath()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            var conferences = new List <Conference>();

            A.CallTo(() => dbContext.Conferences.AddRange(A <IEnumerable <Conference> > .Ignored)).Returns(conferences);

            // Act
            var result = repository.AddEntities(conferences);

            // Assert
            A.CallTo(() => dbContext.Conferences.AddRange(conferences)).MustHaveHappenedOnceExactly();
            Assert.AreSame(conferences, result);
        }
        public void FindEntity_GenericExceptionCaught_LogsAndRethrowsException()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            var name = "Conference";

            A.CallTo(() => dbContext.Conferences.Find(A <string> .Ignored)).Throws <Exception>();

            // Act
            Conference result = null;

            Assert.Throws <Exception>(() => result = repository.FindEntity(name));

            // Assert
            Assert.IsNull(result);
        }
Example #25
0
        public void FindEntity_InvalidOperationExceptionCaught_ThrowsObjectNotFoundException()
        {
            // Arrange
            var repository = new ConferenceRepository();

            var dbContext = A.Fake <ProFootballEntities>();
            var name      = "Conference";

            A.CallTo(() => dbContext.Conferences.Find(A <string> .Ignored)).Throws <InvalidOperationException>();

            // Act
            Conference result = null;

            Assert.Throws <ObjectNotFoundException>(() => { result = repository.FindEntity(dbContext, name); });

            // Assert
            Assert.IsNull(result);
        }
        public void AddConferences_ExceptionCaught_LogsAndRethrowsException()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            var conferences = new List <Conference>();

            A.CallTo(() => dbContext.Conferences.AddRange(A <IEnumerable <Conference> > .Ignored)).Throws <Exception>();

            // Act
            IEnumerable <Conference> result = null;

            Assert.Throws <Exception>(() => result = repository.AddEntities(conferences));

            // Assert
            Assert.IsNull(result);
        }
        public void FindEntity_HappyPath()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new ConferenceRepository(dbContext);

            var name = "Conference";

            var conference = new Conference();

            A.CallTo(() => dbContext.Conferences.Find(A <string> .Ignored)).Returns(conference);

            // Act
            var result = repository.FindEntity(name);

            // Assert
            A.CallTo(() => dbContext.Conferences.Find(name)).MustHaveHappenedOnceExactly();
            Assert.AreSame(conference, result);
        }
Example #28
0
        public async Task FindEntityAsync_EntityFoundInDataStore_ReturnsEntity()
        {
            // Arrange
            var repository = new ConferenceRepository();

            var dbContext = A.Fake <ProFootballEntities>();
            var name      = "Conference";

            Conference conference = new Conference();

            A.CallTo(() => dbContext.Conferences.FindAsync(A <string> .Ignored)).Returns(conference);

            // Act
            var result = await repository.FindEntityAsync(dbContext, name);

            // Assert
            A.CallTo(() => dbContext.Conferences.FindAsync(name)).MustHaveHappenedOnceExactly();
            Assert.AreSame(conference, result);
        }
Example #29
0
        public void EditConference()
        {
            // Arrange
            var repository = new ConferenceRepository();

            var dbContext = A.Fake <ProFootballEntities>();

            A.CallTo(() => dbContext.SetModified(A <Conference> .Ignored)).DoesNothing();

            var conference = new Conference
            {
                Name = "Conference"
            };

            // Act
            repository.EditEntity(dbContext, conference);

            // Assert
            A.CallTo(() => dbContext.SetModified(conference)).MustHaveHappenedOnceExactly();
        }
Example #30
0
        public void AddConference()
        {
            // Arrange
            var repository = new ConferenceRepository();

            var dbContext  = A.Fake <ProFootballEntities>();
            var conference = new Conference
            {
                Name = "Conference"
            };

            A.CallTo(() => dbContext.Conferences.Add(A <Conference> .Ignored)).Returns(conference);

            // Act
            var result = repository.AddEntity(dbContext, conference);

            // Assert
            A.CallTo(() => dbContext.Conferences.Add(conference)).MustHaveHappenedOnceExactly();
            Assert.AreSame(conference, result);
        }
Example #31
0
        public void FindEntity_EntityNotFoundInDataStore_ThrowsObjectNotFoundException()
        {
            // Arrange
            var repository = new ConferenceRepository();

            var dbContext = A.Fake <ProFootballEntities>();
            var name      = "Conference";

            Conference conference = null;

            A.CallTo(() => dbContext.Conferences.Find(A <string> .Ignored)).Returns(conference);

            // Act
            Conference result = null;

            Assert.Throws <ObjectNotFoundException>(() => { result = repository.FindEntity(dbContext, name); });

            // Assert
            A.CallTo(() => dbContext.Conferences.Find(name)).MustHaveHappenedOnceExactly();
            Assert.IsNull(result);
        }
 public CreaturesController()
 {
     _creatureRepository   = new CreatureRepository();
     _conferenceRepository = new ConferenceRepository();
 }