Esempio n. 1
0
        public void UpdateNotesDeleteNoteTest()
        {
            var notes = new List <TestNote>
            {
                new TestNote {
                    ErrorCodeId = 0, Id = 1, Message = "TestMessage"
                }
            };

            var testValue = new TestValue
            {
                TestValueNote = new List <TestValueNote>
                {
                    new TestValueNote
                    {
                        ErrorId         = 2,
                        TestValueNoteId = 1,
                        Message         = "TestMessage"
                    }
                }
            };

            var testBll = MockHelperBll.GetTestBllForDeletingNotes();

            var testServiceHelper = new TestServiceHelper(new NLogLoggerFactory())
            {
                TestBll = testBll
            };

            testServiceHelper.UpdateNotes(notes, testValue);

            Assert.Equal(0, testValue.TestValueNote.Count);
        }
Esempio n. 2
0
        public void UpdateNotesUpdateExistingNoteTest()
        {
            var notes = new List <TestNote>
            {
                new TestNote {
                    ErrorCodeId = 1, Id = 1, Message = "New Message"
                }
            };

            var testValue = new TestValue
            {
                TestValueNote = new List <TestValueNote>
                {
                    new TestValueNote
                    {
                        ErrorId         = 2,
                        TestValueNoteId = 1,
                        Message         = "Old Message"
                    }
                }
            };
            var testServiceHelper = new TestServiceHelper(new NLogLoggerFactory());

            testServiceHelper.UpdateNotes(notes, testValue);

            Assert.Equal(1, testValue.TestValueNote.Count);
            Assert.Equal("New Message",
                         testValue.TestValueNote.First()
                         .Message);
            Assert.Equal(1,
                         testValue.TestValueNote.First()
                         .ErrorId);
        }
Esempio n. 3
0
        public void UpdateNotesNullNotesTest()
        {
            var expectedTestValue = new TestValue
            {
                TestValueNote = new List <TestValueNote>()
            };
            var testServiceHelper = new TestServiceHelper(new NLogLoggerFactory());

            testServiceHelper.UpdateNotes(null, expectedTestValue);

            Assert.Equal(0, expectedTestValue.TestValueNote.Count);
        }
Esempio n. 4
0
        public void CreateNewTestValueTestCreatedPersonTest()
        {
            var expectedTestValue = new TestValue
            {
                TestSheetId   = 1,
                CreatedPerson = "Hans",
                DayInYearOfArticleCreation = 123
            };
            var testServiceHelper = new TestServiceHelper(new NLogLoggerFactory());

            var actual = testServiceHelper.CreateNewTestValue(expectedTestValue.TestSheetId, expectedTestValue.CreatedPerson, expectedTestValue.DayInYearOfArticleCreation, null);

            Assert.Equal(expectedTestValue.CreatedPerson, actual.CreatedPerson);
        }
Esempio n. 5
0
        public void CreateProductionCodeTest2()
        {
            const String expectedResult = "IT/10/17/";
            var          testSheet      = new TestSheet
            {
                MachineNr       = "M10",
                CreatedDateTime = new DateTime(2017, 1, 7)
            };
            var testServiceHelper = new TestServiceHelper(new NLogLoggerFactory());

            var actual = testServiceHelper.CreateProductionCode(testSheet);

            Assert.Equal(expectedResult, actual);
        }
Esempio n. 6
0
        public void UpdateNotesOneNoteTest()
        {
            var notes = new List <TestNote>
            {
                new TestNote {
                    ErrorCodeId = 1, Id = 0, Message = "Testmessage"
                }
            };

            var testValue = new TestValue
            {
                TestValueNote = new List <TestValueNote>()
            };
            var testServiceHelper = new TestServiceHelper(new NLogLoggerFactory());

            testServiceHelper.UpdateNotes(notes, testValue);

            Assert.Equal(1, testValue.TestValueNote.Count);
        }