public void LoginSavePermissions() { var mockData = new MockData { Users = new List <User> { new User { id = 1, username = "******", password = "******", customer_code = "cust", email = "email", Roles = new List <Role> { new Role { id = Role.User } }, Customer = new Customer { code = "cust" }, Permissions = new List <Permission> { new Permission { id = (int)PermissionId.ViewAccountDetails } } } } }; unitOfWork.Data = mockData; var result = controller.Login("username", "password"); var permissions = cache.Get("permissions_1") as List <Permission>; Assert.IsNotNull(permissions); Assert.AreEqual(1, permissions.Count); Assert.IsNotNull(result); var objPermissions = result.GetType().GetProperty("permissions")?.GetValue(result); Assert.IsNotNull(objPermissions); Utils.TestCollection(objPermissions, 1); ; }