public void SingleDelete_DatabaseIsNull_ThrowsException()
        {
            DatabaseMock database = null;
            var          logger   = new ConsoleLogMock();
            SingleDelete singleDelete;

            Assert.ThrowsException <NullReferenceException>(() =>
                                                            singleDelete = new SingleDelete(database, logger));
        }
        public void SingleDeleteStartMeasure_DocumentListIsNull_ThrowsException()
        {
            var             database     = new DatabaseMock();
            var             logger       = new ConsoleLogMock();
            SingleDelete    singleDelete = new SingleDelete(database, logger);
            List <Document> documentList = null;

            Assert.ThrowsException <NullReferenceException>(() =>
                                                            singleDelete.StartMeasure(documentList));
        }
        public void StartMeasure_EveryDocumentGetsDeleted_DeleteListHasNoDocument()
        {
            //Arrange
            var          database     = new DatabaseMock();
            var          logger       = new ConsoleLogMock();
            SingleDelete singleDelete = new SingleDelete(database, logger);
            var          documentList = new List <Document>()
            {
                new Document()
                {
                    ID          = 1,
                    machineName = "Rolle",
                    Operatoren  = new List <Operatoren>()
                    {
                        new Operatoren()
                        {
                            Name = "Lance", Shoesize = 21
                        }
                    }
                },
                new Document()
                {
                    ID          = 2,
                    machineName = "Rolle",
                    Operatoren  = new List <Operatoren>()
                    {
                        new Operatoren()
                        {
                            Name = "Lance", Shoesize = 21
                        }
                    }
                },
                new Document()
                {
                    ID          = 3,
                    machineName = "Rolle",
                    Operatoren  = new List <Operatoren>()
                    {
                        new Operatoren()
                        {
                            Name = "Lance", Shoesize = 21
                        }
                    }
                }
            };

            //Act
            foreach (var document in documentList)
            {
                database.documentsFromSingleDelete.Add(document);
            }
            singleDelete.StartMeasure(documentList);

            Assert.IsTrue(database.documentsFromSingleDelete.Count == 0);
        }
        public void StartMeasure_EveryDocumentGetsUpdated_UpdateListHasEveryDocument()
        {
            //Arrange
            var          database     = new DatabaseMock();
            var          logger       = new ConsoleLogMock();
            SingleUpdate singleUpdate = new SingleUpdate(database, logger);

            var operatorenList = new List <Operatoren>();

            operatorenList.Add(new Operatoren()
            {
                Name = "Lance", Shoesize = 21
            });

            var documentList = new List <Document>()
            {
                new Document()
                {
                    ID          = 1,
                    machineName = "Rolle",
                    Operatoren  = new List <Operatoren>()
                    {
                        new Operatoren()
                        {
                            Name = "Lance", Shoesize = 21
                        }
                    }
                },
                new Document()
                {
                    ID          = 2,
                    machineName = "Rolle",
                    Operatoren  = new List <Operatoren>()
                    {
                        new Operatoren()
                        {
                            Name = "Lance", Shoesize = 21
                        }
                    }
                },
                new Document()
                {
                    ID          = 3,
                    machineName = "Rolle",
                    Operatoren  = new List <Operatoren>()
                    {
                        new Operatoren()
                        {
                            Name = "Lance", Shoesize = 21
                        }
                    }
                }
            };

            //Act
            singleUpdate.StartMeasure(documentList);

            Assert.IsTrue(database.documentsFromSingleUpdate[0] == documentList[0] &&
                          database.documentsFromSingleUpdate[1] == documentList[1] &&
                          database.documentsFromSingleUpdate[2] == documentList[2]);
            Assert.AreEqual(database.documentsFromSingleInsert.Count, documentList.Count);
        }