public void Deactivate_SetsTheInformationEngineToNull()
        {
            var csvReceiver = new CsvReceiver();

            var mock = new Mock<IInformationEngine>();
            mock.Setup(m => m.ProcessNewDiagnoseOutputEntry(It.IsAny<IDiagnoseOutputEntry>(), It.IsAny<Guid>()));

            SetProperty(csvReceiver, mock.Object, "InformationEngine");

            csvReceiver.Deactivate();

            GetProperty(csvReceiver, "InformationEngine").Should().BeNull();
        }
Exemple #2
0
        public void Deactivate_SetsTheInformationEngineToNull()
        {
            var csvReceiver = new CsvReceiver();

            var mock = new Mock <IInformationEngine>();

            mock.Setup(m => m.ProcessNewDiagnoseOutputEntry(It.IsAny <IDiagnoseOutputEntry>(), It.IsAny <Guid>()));

            SetProperty(csvReceiver, mock.Object, "InformationEngine");

            csvReceiver.Deactivate();

            GetProperty(csvReceiver, "InformationEngine").Should().BeNull();
        }
Exemple #3
0
        public void ReadAllEntriesFromFile_NonExistingFile_RetrunsEmptyList()
        {
            var csvReceiver = new CsvReceiver();

            var readAllEntriesFromFileMethod = GetMethodInfo(typeof(CsvReceiver), "ReadAllEntriesFromFile");

            var diagnoseOutputEntries =
                (IEnumerable <IDiagnoseOutputEntry>)
                readAllEntriesFromFileMethod.Invoke(csvReceiver, new object[] { string.Empty });

            diagnoseOutputEntries.Should().NotBeNull();

            diagnoseOutputEntries.Any().Should().Be(false);
        }
Exemple #4
0
        public void ReadAllEntriesFromFile_ExistingFile_RetrunsAllEntries()
        {
            var csvReceiver = new CsvReceiver();

            var readAllEntriesFromFileMethod = GetMethodInfo(typeof(CsvReceiver), "ReadAllEntriesFromFile");

            var diagnoseOutputEntries =
                (IEnumerable <IDiagnoseOutputEntry>)readAllEntriesFromFileMethod.Invoke(
                    csvReceiver,
                    new object[] { Directory.GetCurrentDirectory() + "\\TestData\\TestData.csv" });

            diagnoseOutputEntries.Should().NotBeNull();

            diagnoseOutputEntries.Count().Should().Be(6);
        }
Exemple #5
0
        public void ProcessTheCsvFile_NonExistingFile_CallsTheProcessNewDiagnoseOutputEntryMethodZeroTimes()
        {
            var numberOfCalls = 0;

            var csvReceiver = new CsvReceiver();

            var mock = new Mock <IInformationEngine>();

            mock.Setup(m => m.ProcessNewDiagnoseOutputEntry(It.IsAny <IDiagnoseOutputEntry>(), It.IsAny <Guid>()))
            .Callback(() => numberOfCalls++);

            SetProperty(csvReceiver, mock.Object, "InformationEngine");

            var processTheCsvFileMethod = GetMethodInfo(typeof(CsvReceiver), "ProcessTheCsvFile");

            processTheCsvFileMethod.Invoke(csvReceiver, new object[] { string.Empty });

            numberOfCalls.Should().Be(0);
        }
        public void ProcessTheCsvFile_ExistingFile_CallsTheProcessNewDiagnoseOutputEntryMethodSixTimes()
        {
            var numberOfCalls = 0;

            var csvReceiver = new CsvReceiver();

            var mock = new Mock<IInformationEngine>();
            mock.Setup(m => m.ProcessNewDiagnoseOutputEntry(It.IsAny<IDiagnoseOutputEntry>(), It.IsAny<Guid>()))
                .Callback(() => numberOfCalls++);

            SetProperty(csvReceiver, mock.Object, "InformationEngine");

            var processTheCsvFileMethod = GetMethodInfo(typeof (CsvReceiver), "ProcessTheCsvFile");

            processTheCsvFileMethod.Invoke(
                csvReceiver,
                new object[] {Directory.GetCurrentDirectory() + "\\TestData\\TestData.csv"});

            numberOfCalls.Should().Be(6);
        }
Exemple #7
0
        public void ProcessTheCsvFile_ExistingFile_CallsTheProcessNewDiagnoseOutputEntryMethodSixTimes()
        {
            var numberOfCalls = 0;

            var csvReceiver = new CsvReceiver();

            var mock = new Mock <IInformationEngine>();

            mock.Setup(m => m.ProcessNewDiagnoseOutputEntry(It.IsAny <IDiagnoseOutputEntry>(), It.IsAny <Guid>()))
            .Callback(() => numberOfCalls++);

            SetProperty(csvReceiver, mock.Object, "InformationEngine");

            var processTheCsvFileMethod = GetMethodInfo(typeof(CsvReceiver), "ProcessTheCsvFile");

            processTheCsvFileMethod.Invoke(
                csvReceiver,
                new object[] { Directory.GetCurrentDirectory() + "\\TestData\\TestData.csv" });

            numberOfCalls.Should().Be(6);
        }
        public void ProcessTheCsvFile_NonExistingFile_CallsTheProcessNewDiagnoseOutputEntryMethodZeroTimes()
        {
            var numberOfCalls = 0;

            var csvReceiver = new CsvReceiver();

            var mock = new Mock<IInformationEngine>();
            mock.Setup(m => m.ProcessNewDiagnoseOutputEntry(It.IsAny<IDiagnoseOutputEntry>(), It.IsAny<Guid>()))
                .Callback(() => numberOfCalls++);

            SetProperty(csvReceiver, mock.Object, "InformationEngine");

            var processTheCsvFileMethod = GetMethodInfo(typeof (CsvReceiver), "ProcessTheCsvFile");

            processTheCsvFileMethod.Invoke(csvReceiver, new object[] {string.Empty});

            numberOfCalls.Should().Be(0);
        }
        public void ReadAllEntriesFromFile_NonExistingFile_RetrunsEmptyList()
        {
            var csvReceiver = new CsvReceiver();

            var readAllEntriesFromFileMethod = GetMethodInfo(typeof (CsvReceiver), "ReadAllEntriesFromFile");

            var diagnoseOutputEntries =
                (IEnumerable<IDiagnoseOutputEntry>)
                readAllEntriesFromFileMethod.Invoke(csvReceiver, new object[] {string.Empty});

            diagnoseOutputEntries.Should().NotBeNull();

            diagnoseOutputEntries.Any().Should().Be(false);
        }
        public void ReadAllEntriesFromFile_ExistingFile_RetrunsAllEntries()
        {
            var csvReceiver = new CsvReceiver();

            var readAllEntriesFromFileMethod = GetMethodInfo(typeof (CsvReceiver), "ReadAllEntriesFromFile");

            var diagnoseOutputEntries =
                (IEnumerable<IDiagnoseOutputEntry>) readAllEntriesFromFileMethod.Invoke(
                    csvReceiver,
                    new object[] {Directory.GetCurrentDirectory() + "\\TestData\\TestData.csv"});

            diagnoseOutputEntries.Should().NotBeNull();

            diagnoseOutputEntries.Count().Should().Be(6);
        }