Popular Posts
-
Kendo UI applying SUM in footer template kendo ui - KendoUI: Grid Summary values in Footer - Stack Overflow : ", footerTemplate:...
-
MVC grid example ASP.NET MVC Flexigrid sample - CodeProject : 'via Blog this'
-
A possible way of handling distributed transaction for multiple contexts without alleviation to MSDTC??? c# - Entity Framework - Using Trans...
Monday, June 27, 2016
Passing data from controller to view mb
http://www.codeproject.com/Articles/1108855/ways-to-Bind-Multiple-Models-on-a-View-in-MVC
Saturday, June 25, 2016
Friday, June 24, 2016
Thursday, June 23, 2016
Azure Website Slow on First Request part II – Simon J.K. Pedersen's Azure & SharePoint blog
Azure Website Slow on First Request part II – Simon J.K. Pedersen's Azure & SharePoint blog
webjob to keep the website alive.
free azure website keep always one
webjob to keep the website alive.
free azure website keep always one
Tuesday, June 21, 2016
Testing, generating data automatically using AutoFixture/AutoFixture: AutoFixture is an open source library for .NET designed to minimize the 'Arrange' phase of your unit tests in order to maximize maintainability. Its primary goal is to allow developers to focus on what is being tested rather than how to setup the test scenario, by making it easier to create object graphs containing test data.
GitHub - AutoFixture/AutoFixture: AutoFixture is an open source library for .NET designed to minimize the 'Arrange' phase of your unit tests in order to maximize maintainability. Its primary goal is to allow developers to focus on what is being tested rather than how to setup the test scenario, by making it easier to create object graphs containing test data.
Testing, mocking and autofixture
Testing, mocking and autofixture
Testing Entity framework using Moq and extension method
Moq extension to transform a list to Moq of DBSet for testing the Entity Framework DbSet.
public static class Extensions { public static Mock<DbSet<T>> GetMockSet<T>(this IQueryable<T> data) where T : class { var mockSet = new Mock<DbSet<T>>(); mockSet.As<IQueryable<T>>().Setup(m => m.Provider).Returns(data.Provider); mockSet.As<IQueryable<T>>().Setup(m => m.Expression).Returns(data.Expression); mockSet.As<IQueryable<T>>().Setup(m => m.ElementType).Returns(data.ElementType); mockSet.As<IQueryable<T>>().Setup(m => m.GetEnumerator()).Returns<T>(x => data.GetEnumerator()); return mockSet; } }
To use it in the test as following:
[TestMethod] public void GetCustomer_Mocked_With_Extension() { var mockedContext = new Mock<IDbContext>(); var data = new List<Customer> { new Customer { FirstName = "Rahman", LastName = "Mahmoodi", Id = 1 } }.AsQueryable(); var mockSet = data.GetMockSet<Customer>(); // This is how to use it mockedContext.Setup(x => x.Customers).Returns(mockSet.Object); var cbo = new CustomerBusinessObject(mockedContext.Object); var c = cbo.Get(1); Assert.IsTrue(c.FirstName == "Rahman"); }
Monday, June 20, 2016
Friday, June 17, 2016
Populating combos from enum
http://www.codeproject.com/Articles/1105885/Populating-Combo-Boxes-from-Enums
Subscribe to:
Posts (Atom)