Exemple #1
0
        public async Task Edit_Some_Storage()
        {
            // Arrange
            var storage = new Storage()
            {
                Id = 1, City = "Lviv", Street = "Rubchaka, 56"
            };
            var model = new CreateStorageView()
            {
                City = storage.City, Street = storage.Street
            };
            var editModel = new EditSorageView()
            {
                City = "Kiev", Street = storage.Street
            };

            // Act
            await controller.Create(model);

            editModel.Id = context.Storages.First().Id;
            await controller.Edit(editModel);

            // Assert
            Assert.AreEqual(1, context.Storages.Count());
            Assert.AreEqual(model.Street, context.Storages.Single().Street);
            Assert.AreNotEqual(editModel.City, model.City);
            Assert.AreEqual(editModel.City, context.Storages.Single().City);
        }