public void Add() { var libraryService = new LibraryService(); Assert.AreEqual(true, libraryService.Add("1,ddddddd,0", out message)); Assert.AreEqual(true, libraryService.Add("2,cccccc,1", out message)); Assert.AreEqual(true, libraryService.Add("3,bbbbb,2", out message)); Assert.AreEqual(true, libraryService.Add("4,aaaa,2", out message)); Assert.AreEqual(4, libraryService.Count()); Assert.AreEqual(false, libraryService.Add("1,ddddddd,0", out message)); Assert.AreEqual("Id already exist, start again with different ID", message); Assert.AreEqual(true, libraryService.Add("5,ddddddd,0", out message)); Assert.AreEqual("Added", message); Assert.AreEqual(false, libraryService.Add("6,Invalid Type,5", out message)); Assert.AreEqual("Invalid Type", message); }
public void AllItems() { var libraryService = new LibraryService(); Assert.AreEqual(true, libraryService.Add("1,ddddddd,2", out message)); Assert.AreEqual(true, libraryService.Add("2,bbbbb,2", out message)); Assert.AreEqual(true, libraryService.Add("3,bbbbb,0", out message)); Assert.AreEqual(true, libraryService.Add("4,aaaa,2", out message)); Assert.AreEqual(4, libraryService.Count()); Assert.AreEqual("Id already checked in, start again with different ID", libraryService.CheckIn("4")); Assert.AreEqual("Lent out", libraryService.Lent("4")); Assert.AreEqual("Checked In", libraryService.CheckIn("4")); Assert.AreEqual("Id not exists, start again with different ID", libraryService.CheckIn("5")); Assert.AreEqual(0, libraryService.LentOutItems().Count()); Assert.AreEqual("Lent out", libraryService.Lent("1")); Assert.AreEqual(4, libraryService.AllItems().Count()); Assert.AreEqual("3", libraryService.AllItems().FirstOrDefault().Id); Assert.AreEqual("4", libraryService.AllItems().ElementAt(1).Id); }
public void CheckIn() { var libraryService = new LibraryService(); Assert.AreEqual(true, libraryService.Add("1,ddddddd,0", out message)); Assert.AreEqual(true, libraryService.Add("2,cccccc,1", out message)); Assert.AreEqual(true, libraryService.Add("3,bbbbb,2", out message)); Assert.AreEqual(true, libraryService.Add("4,aaaa,2", out message)); Assert.AreEqual(4, libraryService.Count()); Assert.AreEqual("Id already checked in, start again with different ID", libraryService.CheckIn("4")); Assert.AreEqual("Lent out", libraryService.Lent("4")); Assert.AreEqual("Checked In", libraryService.CheckIn("4")); Assert.AreEqual("Id not exists, start again with different ID", libraryService.CheckIn("5")); }
public void Add_Exception_TwoParam() { var libraryService = new LibraryService(); libraryService.Add("x,333", out message); }
public void Add_Exception_OneParam() { var libraryService = new LibraryService(); libraryService.Add("1", out message); }
public void Add_Exception() { var libraryService = new LibraryService(); libraryService.Add("", out message); }
public bool Add(string inputString) { var libraryService = new LibraryService(); return libraryService.Add(inputString, out message); }