コード例 #1
0
        public void PaymentRepository_NullReferenceException_Failed()
        {
            //Arrange
            var repo = new PaymentRepository(_mockDataSource.Object);

            //Act and Assert
            Assert.ThrowsExceptionAsync <NullReferenceException>(() => repo.AddItemAsync(null), "Null Reference Exception. Parameter cannot be null.");
        }
コード例 #2
0
        public void PaymentRepository_AddItemAsync_Payment_Already_Exists_Failed()
        {
            //Arrange
            var repo = new PaymentRepository(_mockDataSource.Object);
            //Act
            var result = repo.AddItemAsync(_payment).Result;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsFalse(result);
        }
コード例 #3
0
        public void PaymentRepository_AddItemAsync_Payment_No_Exists_Successful()
        {
            //Arrange
            var repo = new PaymentRepository(_mockDataSource.Object);
            //Act
            //Simulates a Non Existing payment in Storage
            var temp   = new Payment();
            var result = repo.AddItemAsync(temp).Result;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result);
        }