public void PostMethod_ShouldCreateCustomer()
        {
            // Arrange
            var data = new List <CustomerDetails> {
                new CustomerDetails {
                    Id = 10, UserName = "******", Name = "customername3", Email = "*****@*****.**", Password = "******", DateOfBirth = new DateTime(1987, 07, 14), State = "Miami", ContactNumber = "9857893645", Address = "1/234 , Customer street 3", PermanentAccountNumber = "Pan321231", Country = "USA", AccountType = "Saving account"
                }
            }.AsQueryable();

            var mockSet = new Mock <DbSet <CustomerDetails> >();

            mockSet.As <IQueryable <CustomerDetails> >().Setup(m => m.Provider).Returns(data.Provider);
            mockSet.As <IQueryable <CustomerDetails> >().Setup(m => m.Expression).Returns(data.Expression);
            mockSet.As <IQueryable <CustomerDetails> >().Setup(m => m.ElementType).Returns(data.ElementType);
            mockSet.As <IQueryable <CustomerDetails> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            var mockContext = new Mock <IApplicationDbContext>();

            mockContext.Setup(c => c.CustomerDetails).Returns(mockSet.Object);

            // Act
            var service = new CustomerDetailsRepository(mockContext.Object);

            // Act
            service.AddCustomerDetail(data.First());
            var customerDetails = service.GetCustomerDetailsById(data.First().Id);


            // Assert
            Assert.Equal(data.First().Name, customerDetails.Name);
            Assert.Equal(data.First().Id, customerDetails.Id);
            Assert.Equal(data.First().UserName, customerDetails.UserName);
        }
        public void GetCustomerByIdNotPresent_ShouldNotCustomerDetails()
        {
            //Arrange
            var context = MockDbRepository();
            var service = new CustomerDetailsRepository(context.Object);
            var id      = 5000;

            //Act
            var customerDetails = service.GetCustomerDetailsById(id);

            // Assert
            Assert.Null(customerDetails);
        }
        public void GetCustomerById_ShouldReturnCustomerDetails()
        {
            //Arrange
            var context = MockDbRepository();
            var service = new CustomerDetailsRepository(context.Object);
            var id      = 200;

            //Act
            var customerDetails = service.GetCustomerDetailsById(id);

            // Assert
            Assert.NotNull(customerDetails);
            Assert.Equal("customername1", customerDetails.Name);
        }