public void UserBuildingCreateTrue() { Program.SetSessionFactory(true); Program.CreateData(); var authRepo = new AuthorisationRepository(); var user = authRepo.CreateUser(Create()); Assert.NotNull(user); var resorceRepository = new Repository<Resource>(); var metal = resorceRepository.Get(new Dictionary<string, string>() { { "Name", "Metal" } }).First(); var carbon = resorceRepository.Get(new Dictionary<string, string>() { { "Name", "Carbon" } }).First(); var buildingLevel = new BuildingLevel() { Level = 1, BuildingCosts = new List<BuildingCost>(){ new BuildingCost(){ Resource = metal, Value = 100 }, new BuildingCost(){ Resource = carbon, Value = 200 } } }; Assert.True(user.UserHasReseourceForBuild(buildingLevel)); }
public void UserHasEnaughResourcesForResearchFalse() { Program.SetSessionFactory(true); Program.CreateData(); var authRepo = new AuthorisationRepository(); var user = authRepo.CreateUser(Create()); Assert.NotNull(user); var resorceRepository = new Repository<Resource>(); var metal = resorceRepository.Get(new Dictionary<string, string>() { { "Name", "Metal" } }).First(); var carbon = resorceRepository.Get(new Dictionary<string, string>() { { "Name", "Carbon" } }).First(); var researchLevel = new ResearchLevel() { Level = 1, ResearchCosts = new List<ResearchCost>(){ new ResearchCost(){ Resource = metal, Value = 500 }, new ResearchCost(){ Resource = carbon, Value = 200 } } }; Assert.False(user.UserHasResourcesForResearch(researchLevel)); }
public void CreateUser() { var authRepo = new AuthorisationRepository(); var user = authRepo.CreateUser(Create()); Assert.NotNull(user); }