public HomeController(LivestockContext livestockDb, AimLoginContext loginDb, IAimUserManager userManager, DataMapService <User> data) { this.livestockDb = livestockDb; this.loginDb = loginDb; this.userManager = userManager; this.data = data; }
public GroupController(AimLoginContext loginDb, LivestockContext livestockDb, DataMapService <AdmuGroup> data, DataMapService <User> userData) { this.loginDb = loginDb; this.livestockDb = livestockDb; this.data = data; this.userData = userData; }
public AccountController(LivestockContext livestockDb, AimLoginContext aimloginDb, IAimUserManager aimloginUsers, DataMapService <User> aimLoginData, IAimHasher aimHasher) { this.livestockDb = livestockDb; this.aimLoginData = aimLoginData; this.aimloginDb = aimloginDb; this.aimloginUsers = aimloginUsers; this.aimHasher = aimHasher; }
public void Check_CreateSportMenu_MatchCount() { // Arrange var mock = CreateDataServiceMock(); var dataMapMock = new DataMapService(mock.Object); // act var result = dataMapMock.CreateSportMenu(); // Assert Assert.AreEqual(2, result.Count); Assert.AreEqual(2, result[0].SportList.Count); Assert.AreEqual(4, result[0].SportList[0].MatchCount); Assert.AreEqual(3, result[0].SportList[1].MatchCount); }
public void Check_EventDetails_ApplyMargin() { // Arrange const double MarginValue = 10; var mock = CreateDataServiceMock(); mock.Setup(t => t.GetSportMargin(1, 1)).Returns(MarginValue); mock.Setup(t => t.GetSportMargin(It.IsNotIn(1), It.IsAny <int>())).Returns(1); mock.Setup(t => t.GetSportMargin(It.IsAny <int>(), It.IsNotIn(1))).Returns(1); var dataMapMock = new DataMapService(mock.Object); // act var configList = dataMapMock.CreateEventDetails(); // Assert Assert.AreEqual(1.14 * MarginValue, configList[0].EventDetailsList[0].Markets[0].Outcomes[0].Price); Assert.AreEqual(1.14, configList[1].EventDetailsList[0].Markets[0].Outcomes[0].Price); }
private static void UpdateCache() { // Console.WriteLine("Update cache"); using (var context = new MsSqlContext()) { var dms = new DataMapService(context); var sportMenuList = dms.CreateSportMenu(); var eventDetails = dms.CreateEventDetails(); var upcomingEvents = dms.CreateUpcomingEvents(); using (var cacheDb = new MongoContext()) { cacheDb.ReplaceAll(sportMenuList); cacheDb.ReplaceAll(eventDetails); cacheDb.ReplaceAll(upcomingEvents); } } }
public static async Task SetRoleFor(this DataMapService <User> data, User user, RoleEnum role, LivestockContext db) { Contract.Requires(user != null); Contract.Requires(data != null); Contract.Requires(db != null); var roleName = Convert.ToString(role).ToLower(); var dbRole = await db.Role.FirstOrDefaultAsync(r => r.Description == roleName); if (dbRole == null) { dbRole = new Role { Comment = "N/A", Description = roleName, VersionNumber = 1 }; await db.Role.AddAsync(dbRole); await db.SaveChangesAsync(); } await data.SingleReference <Role>().SetAsync(user, dbRole); }
public AdminController(AimLoginContext loginDb, LivestockContext livestockDb, DataMapService <User> data) { this.loginDb = loginDb; this.livestockDb = livestockDb; this.data = data; }