Beispiel #1
0
        public void LogRepositoryMock_Delete_First_Item_Should_Pass()
        {
            // Delete the first item from the list, and then check the list to verify it is gone

            // Arange
            var myData = new LogRepositoryMock();

            // Get the first item from the list
            var oldItem = myData.Index().First();

            // Act
            var result  = myData.Delete(oldItem.ID);
            var newItem = myData.Index().First();

            // Assert
            Assert.AreNotEqual(oldItem.ID, newItem.ID);
        }
Beispiel #2
0
        public void LogRepositoryMock_Index_Default_Should_Pass()
        {
            // Should load the dataset with 4 rows

            // Arange
            var myData = new LogRepositoryMock();

            // Act
            var result = myData.Index();

            // Assert
            Assert.AreEqual(4, result.Count);
        }
Beispiel #3
0
        public void LogRepositoryMock_Update_InValid_Bogus_Item_Should_Pass()
        {
            // Arange
            var myData  = new LogRepositoryMock();
            var oldItem = myData.Index().First();

            var newItem = new LogModel();

            newItem.ID = "bogus";

            // Act
            var result = myData.Update(newItem);

            // Assert
            Assert.AreEqual(null, result);
        }
Beispiel #4
0
        public void LogRepositoryMock_Read_Valid_Item_Should_Pass()
        {
            // Delete the first item from the list, and then check the list to verify it is gone

            // Arange
            var myData = new LogRepositoryMock();

            // Get the first item from the list
            var oldItem = myData.Index().First();

            // Act
            var newItem = myData.Read(oldItem.ID);

            // Check each item one by one to ensure it is correctly loaded

            // Assert
            Assert.AreEqual(oldItem.ID, newItem.ID);
            Assert.AreEqual(oldItem.PhoneID, newItem.PhoneID);
            Assert.AreEqual(oldItem.RecordedDateTime, newItem.RecordedDateTime);
            Assert.AreEqual(oldItem.Value, newItem.Value);
        }