Ejemplo n.º 1
0
        public void LogRepositoryMock_Read_InValid_Bogus_Item_Should_Pass()
        {
            // Arange
            var myData = new LogRepositoryMock();

            // Act
            var newItem = myData.Read("bogus");

            // Assert
            Assert.AreEqual(null, newItem);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public void LogRepositoryMock_Update_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();
            var oldPhoneID = oldItem.PhoneID;

            // Change the ID
            oldItem.PhoneID = "UpdatedPhone";


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

            // Assert
            Assert.AreNotEqual(oldPhoneID, newItem.PhoneID);
        }