コード例 #1
0
 public Librarian(Guid id, string fullName, LibraryDepartment department)
     : this()
 {
     Id         = id;
     FullName   = fullName;
     Department = department;
 }
コード例 #2
0
 public Librarian(string fullName, LibraryDepartment department)
     : this()
 {
     Id         = Guid.NewGuid();
     FullName   = fullName;
     Department = department;
 }
 private static bool LibraryDepartmentCompare(LibraryDepartment a, LibraryDepartment b)
 {
     if (Object.ReferenceEquals(a, b))
     {
         return true;
     }
     return a.Id == b.Id && a.Name == b.Name;
 }
 private static bool LibraryDepartmentCompare(LibraryDepartment a, LibraryDepartment b)
 {
     if (Object.ReferenceEquals(a, b))
     {
         return(true);
     }
     return(a.Id == b.Id && a.Name == b.Name);
 }
コード例 #5
0
 public Book(string author, string title, int year, LibraryDepartment department)
     : this()
 {
     Id = Guid.NewGuid();
     Author = author;
     Title = title;
     Year = year;
     Department = department;
 }
コード例 #6
0
 public Book(Guid id, string author, string title, int year, LibraryDepartment department)
     : this()
 {
     Id         = id;
     Author     = author;
     Title      = title;
     Year       = year;
     Department = department;
 }
 public override void Save(LibraryDepartment item)
 {
     LibraryDepartment department = GetItem(item.Id);
     if (department == null)
     {
         context.LibraryDepartments.InsertOnSubmit(item);
     }
     else
     {
         department.Name = item.Name;
         department.IsAbonement = item.IsAbonement;
     }
     context.SubmitChanges();
 }
        public void Department_Exists_Test()
        {
            var listDepartments = new List<LibraryDepartment>();
            var department = new LibraryDepartment(Guid.Empty, "Абонемент", true);
            listDepartments.Add(department);
            library.Setup(lib => lib.GetDepartments()).Returns(listDepartments);

            var result = libraryController.Department(Guid.Empty) as ViewResult;

            library.Verify(lib => lib.GetBooksByDepartment(department));
            Assert.IsNotNull(result);
            Assert.AreEqual(department.Name, result.ViewData["Title"]);
            Assert.AreEqual("ListBooks", result.ViewName);
        }
        public LibraryClassTest()
        {
            repository = new Repository(new MSSQLRepositoryFactory());

            reader = new Reader("First Reader", "Brest");
            repository.ReaderRepository.Save(reader);
            department = new LibraryDepartment("Abonement", true);
            repository.LibraryDepartmentRepository.Save(department);
            librarian = new Librarian("First Librarian ", department);
            repository.LibrarianRepository.Save(librarian);
            book = new Book("First Author", "Title", 2002, department);
            repository.BookRepository.Save(book);
            book2 = new Book("Second Author", "Title", 2000, department);
            repository.BookRepository.Save(book2);

            library = new LibraryClass(repository);
        }
 public override IEnumerable<Book> GetBooksByDepartment(LibraryDepartment department)
 {
     return context.Books.Where(book => book.Department.Id == department.Id);
 }
		partial void UpdateLibraryDepartment(LibraryDepartment instance);
		partial void DeleteLibraryDepartment(LibraryDepartment instance);
 public IEnumerable<Book> GetBooksByDepartment(LibraryDepartment department)
 {
     return repository.BookRepository.GetBooksByDepartment(department);
 }
		partial void InsertLibraryDepartment(LibraryDepartment instance);
 partial void InsertLibraryDepartment(LibraryDepartment instance);
 public override void Remove(LibraryDepartment item)
 {
     Remove(item.Id);
 }
 partial void UpdateLibraryDepartment(LibraryDepartment instance);
 partial void DeleteLibraryDepartment(LibraryDepartment instance);
 public LibraryDepartmentTest()
 {
     ld1 = new LibraryDepartment("Name1", true);
     ld2 = new LibraryDepartment("Name2", false);
     ld3 = new LibraryDepartment(ld1.Id, "Name1", true);
 }