Example #1
0
        public void CanGetEventsForSpecificMachine(IEventRepository repo)
        {
            const string            machine1 = "machine1";
            const string            machine2 = "machine2";
            LibraryItemEventFactory factory1 = new LibraryItemEventFactory(new Clock(), machine1);
            LibraryItemEventFactory factory2 = new LibraryItemEventFactory(new Clock(), machine2);

            Guid guid = Guid.NewGuid();

            repo.Save(factory1.GetPlayedEvent(guid));
            repo.Save(factory2.GetPlayedEvent(guid));

            repo.GetAllEvents().Count().Should().Be(2);
            repo.GetAllEventsFromMachine(machine1).Count().Should().Be(1);
            repo.GetAllEventsFromMachine(machine2).Count().Should().Be(1);
        }
Example #2
0
        public void CanGetEventsMachineNameCaseDoesNotMatter(IEventRepository repo)
        {
            const string            machine1 = "machine1";
            const string            machine2 = "machine2";
            LibraryItemEventFactory factory1 = new LibraryItemEventFactory(new Clock(), machine1);
            LibraryItemEventFactory factory2 = new LibraryItemEventFactory(new Clock(), machine2);

            Guid guid = Guid.NewGuid();

            repo.Save(factory1.GetPlayedEvent(guid));

            repo.GetAllEventsFromMachine(machine1.ToUpper()).Count().Should().Be(1);

            repo.GetAllEventsFromMachine(machine2.ToUpper()).Count().Should().Be(0);

            repo.Save(factory2.GetPlayedEvent(guid));
            repo.GetAllEventsFromMachine(machine2.ToUpper()).Count().Should().Be(1);
        }
Example #3
0
 public EventController(ILogger <EventController> logger, ISerializedEventRepository eventRepo, LibraryItemEventFactory eventFactory)
 {
     _logger       = logger;
     _eventRepo    = eventRepo;
     _eventFactory = eventFactory;
 }
Example #4
0
 public InMemoryTests()
 {
     _eventFactory = new LibraryItemEventFactory();
 }