1234567891011121314151617181920212223242526272829303132333435363738 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System;
- using NET;
- using System.Linq;
- namespace UnitTestProject1
- {
- [TestClass]
- public class InsertTest
- {
- BookStoreContext _context = new BookStoreContext();
- MainWindow page = new MainWindow();
- [TestMethod]
- public void Insert()
- {
- string name, price, author, category;
- name = "Токийские легенды";
- price = "566";
- author = "Харуки Мураками";
- category = "Сборник рассказов";
- Assert.IsTrue(page.Insert(name, price, author, category));
- Books book = _context.Books.Where(x => x.Name == name).FirstOrDefault();
- _context.Books.Remove(book);
- _context.SaveChanges();
- name = "Токийские легенды";
- price = "mems";
- author = "Харуки Мураками";
- category = "Сборник рассказов";
- Assert.IsFalse(page.Insert(name, price, author, category));
- }
- }
- }
|