public static void Register(HttpConfiguration config) { BLLAutoMapper.Initialize(); // Web API configuration and services var cors = new EnableCorsAttribute("*", "*", "*"); config.EnableCors(cors); // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }
public void CheckUserByLoginAndPassword() { ResetData(); BLLAutoMapper.Initialize(); List <DBUser> users = new List <DBUser>(); DBUser user1 = new DBUser(); DBUser user2 = new DBUser(); string login = "******"; string password = "******"; user1.Login = login; user1.Password = password; user1.UserId = 1; users.Add(user1); users.Add(user2); mockUsers.Setup(a => a.Get()).Returns(users); int expected = Mapper.Map <DBUser, User>(user1).UserId; var result = UserO.CheckUser(login, password); Assert.AreEqual(expected, result); }