コード例 #1
0
        public void SetupForTests()
        {
            _testCollector = new Collector(new DatabaseContext());

            _testItem = new Item() { ItemId = 100, Name = "TestItem", IsBought = true };
            _testIngredient = new Ingredient() { ItemId = 101, Name = "TestIngredient", Amount = 10 };
            _testRecipe = new Recipe() { RecipeId = 100, RecipeName = "TestOpskrift", Ingredients = new List<Ingredient>() { _testIngredient, new Ingredient() }, AddedTime = DateTime.Now };
            _testFoodplan = new Foodplan() { FoodPlanId = 100, CreatedDate = DateTime.Now, Recipies = new List<RecipesInFoodplan>() { new RecipesInFoodplan() {Recipe = _testRecipe, RecipeDate = DateTime.Now} }, FoodplanStartTime = DateTime.Now, FoodplanEndTime = DateTime.MaxValue, LastModified = DateTime.Now };
            _testShoppinglist = new Shoppinglist() { ShoppingListId = 100, Items = new List<Item>() { _testItem } };
            _testUser = new User() { UserId = 100, UserName = "******", UserPassword = "******", UserFoodplan = _testFoodplan, UserShoppingList = _testShoppinglist };
        }
コード例 #2
0
        public void UserUpdate_UserisUpdated_SavesCorrect()
        {
            User userToSave = new User() { UserName = "******", UserPassword = "******"};
            _testCollector.Users.Add(userToSave);
            _testCollector.Save();
            userToSave.UserName = "******";
            _testCollector.Users.Update(userToSave);
            _testCollector.Save();

            User toCheck = _testCollector.Users.GetUserFromUsername("Updated").First();

            Assert.That("Updated", Is.EqualTo(toCheck.UserName));

            _testCollector.Users.Delete(_testCollector.Users.GetWithId(toCheck.UserId));
            _testCollector.Save();
        }