public void CanRemoveSingleFile() { builder.UseInMemoryDatabase("RemoveSingleFile"); using (var context = new FileSystemContext(builder.Options)) { var bizlogic = new BusinessDataLogic(context); var file = new File() { Name = "RemoveFile", DirectoryId = 1 }; var file1 = new File() { Name = "RemoveFile1", DirectoryId = 1 }; var file2 = new File() { Name = "RemoveFile2", DirectoryId = 1 }; bizlogic.Touch(file); bizlogic.Touch(file1); bizlogic.Touch(file2); bizlogic.Rm(file1); } using (var context2 = new FileSystemContext(builder.Options)) { Assert.Equal(2, context2.Files.Count()); } }
public void CanInsertSamuraiwithQuotes() { var samuraiGraph = new Samurai { Name = "Kyūzō", Quotes = new List <Quote> { new Quote { Text = "Watch out for my sharp sword!" }, new Quote { Text = "I told you to watch out for the sharp sword! Oh well!" } } }; var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("SamuraiWithQuotes"); using (var context = new SamuraiContext(builder.Options)) { var bizlogic = new BusinessDataLogic(context); var result = bizlogic.InsertNewSamurai(samuraiGraph); }; using (var context2 = new SamuraiContext(builder.Options)) { var samuraiWithQuotes = context2.Samurais.Include(s => s.Quotes).FirstOrDefaultAsync().Result; Assert.AreEqual(2, samuraiWithQuotes.Quotes.Count); } }
public void CanGetSamuraiwithQuotes() { int samuraiId; var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("SamuraiWithQuotes"); using (var seedcontext = new SamuraiContext(builder.Options)) { var samuraiGraph = new Samurai { Name = "Kyūzō", Quotes = new List <Quote> { new Quote { Text = "Watch out for my sharp sword!" }, new Quote { Text = "I told you to watch out for the sharp sword! Oh well!" } } }; seedcontext.Samurais.Add(samuraiGraph); seedcontext.SaveChanges(); samuraiId = samuraiGraph.Id; } using (var context = new SamuraiContext(builder.Options)) { var bizlogic = new BusinessDataLogic(context); var result = bizlogic.GetSamuraiWithQuotes(samuraiId); Assert.AreEqual(2, result.Quotes.Count); }; }
public void CanRemoveSingleDirectory() { builder.UseInMemoryDatabase("RemoveSingleDirectory"); using (var context = new FileSystemContext(builder.Options)) { var bizlogic = new BusinessDataLogic(context); var dir = new Directory() { Name = "RemoveDir" }; var dir1 = new Directory() { Name = "RemoveDir1" }; var dir2 = new Directory() { Name = "RemoveDir2" }; bizlogic.MkDir(dir); bizlogic.MkDir(dir1); bizlogic.MkDir(dir2); bizlogic.RmDir(dir1); } using (var context2 = new FileSystemContext(builder.Options)) { Assert.Equal(2, context2.Directories.Count()); } }
public void CanGetSamuraiWithQuotes() { int samuraiId; var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("SamuraiWithQuotes"); using (var seedcontext = new SamuraiContext(builder.Options)) { var samuraiGraph = new Samurai { Name = "Kyuzo", Quotes = new List <Quote> { new Quote { Text = "hello" }, new Quote { Text = "world" } } }; seedcontext.Samurais.Add(samuraiGraph); seedcontext.SaveChanges(); samuraiId = samuraiGraph.Id; } using (var context = new SamuraiContext(builder.Options)) { var bizlogic = new BusinessDataLogic(context); var result = bizlogic.GetSamuraiWithQuotes(samuraiId); Assert.Equal(2, result.Quotes.Count); } }
//private static void ExecuteSomeRawSql() //{ // //var samuraiId = 2; // //var affected = _context.Database // // .ExecuteSqlRaw("EXEC DeleteQuotesForSamurai {0}", samuraiId); // when using sqlRaw, do remember to pass parameter // var samuraiId = 2; // var affected = _context.Database // .ExecuteSqlInterpolated($"EXEC DeleteQuotesForSamurai {samuraiId}"); //} //private static void QueryUsingFromSqlIntStoredProd() //{ // var text = "Happy"; // var samurais = _context.Samurais.FromSqlInterpolated( // $"EXEC dbo.SamuraisWhoSaidAWord {text}").ToList(); //} //private static void QueryUsingFromSqlRawStoredProd() //{ // var text = "Happy"; // var samurais = _context.Samurais.FromSqlRaw( // "EXEC dbo.SamuraisWhoSaidAWord {0}", text).ToList(); //} //private static void QueryUsingRawSqlWithInterpolation() //{ // string name = "Kikuchyo"; // var samurais = _context.Samurais // .FromSqlInterpolated($"Select * from Samurais Where Name = {name}") // .ToList(); //} //private static void QueryUsingRawSql() //{ // // must return data for ALL properties of the entity type, no more, no less // // Column names in results must match mapped column names // // it will be tracked // var samurais = _context.Samurais.FromSqlRaw("Select * from samurais").ToList(); //} //private static void QuerySamuraiBattleStats() //{ // var stats = _context.SamuraiBattleStats.ToList(); // var firstStats = _context.SamuraiBattleStats.FirstOrDefault(); // var sampsonStats = _context.SamuraiBattleStats // .FirstOrDefault(b => b.Name == "SampsonSan"); // var findOne = _context.SamuraiBattleStats.Find(2); // be carefull with find, compiler would be find, but runtime exception because there is no key //} //private static void GetSamuraiWithHorse() //{ // var horseonly = _context.Set<Horse>().Find(4); // var horseWithSamurai = _context.Samurais.Include(s => s.Horse) // .FirstOrDefault(s => s.Horse.Id == 4); // var horseSamuraiPairs = _context.Samurais // .Where(s => s.Horse != null) // .Select(s => new { Horse = s.Horse, Samurai = s }) // .ToList(); //} //private static void ReplaceAHorse() //{ // //var samurai = _context.Samurais.Include(s => s.Horse) // // .FirstOrDefault(s => s.Id == 5); // //samurai.Horse = new Horse { Name = "Trigger" }; // //_context.SaveChanges(); // // horse trading // var horse = _context.Set<Horse>().FirstOrDefault(h => h.Name == "Mr. Ed"); // horse.SamuraiId = 5; // owns Trigger! // _context.SaveChanges(); // throws exception //} //private static void AddNewHorseToDisconnectedSamuraiObject() //{ // var samurai = _context.Samurais.AsNoTracking().FirstOrDefault(s => s.Id == 5); // samurai.Horse = new Horse { Name = "Mr. Ed" }; // using var newContext = new SamuraiContext(); // newContext.Samurais.Attach(samurai); // newContext.SaveChanges(); //} //private static void AddNewHorseToSamuraiObject() //{ // var samurai = _context.Samurais.Find(12); // There is already a samurai in memory // samurai.Horse = new Horse { Name = "Black Beauty" }; // _context.SaveChanges(); //} //private static void AddNewHorseToSamuraiUsingId() //{ // var horse = new Horse { Name = "Scount", SamuraiId = 2 }; // _context.Add(horse); // _context.SaveChanges(); //} //private static void AddNewSamuraiWithHorse() //{ // var samurai = new Samurai { Name = "Jina Ujichika" }; // samurai.Horse = new Horse { Name = "Silver" }; // _context.Samurais.Add(samurai); // _context.SaveChanges(); //} //private static void RemoveSamuraiFromABattle() //{ // var battleWithSamurai = _context.Battles // .Include(b => b.Samurais.Where(s => s.Id == 12)) // .Single(s => s.BattleId == 1); // var samurai = battleWithSamurai.Samurais[0]; // battleWithSamurai.Samurais.Remove(samurai); // _context.SaveChanges(); //} //private static void WillNotRemoveSamuraiFromABattle() //{ // var battle = _context.Battles.Find(1); // var samurai = _context.Samurais.Find(12); // battle.Samurais.Remove(samurai); // _context.SaveChanges(); // the relationship is not being tracked, so nothing gets removed //} //private static void AddAllSamuraisToAllBattles() //{ // var allBattles = _context.Battles.Include(b => b.Samurais).ToList(); // eager load so changeTracker knows what are changed, but be careful performance issue // var allSamurais = _context.Samurais.ToList(); // foreach (var battle in allBattles) // { // battle.Samurais.AddRange(allSamurais); // } // _context.SaveChanges(); //} //private static void ReturnAllBattlesWithSamurais() //{ // var battle = _context.Battles.Include(b => b.Samurais).ToList(); //} //private static void ReturnBattleWithSamurais() //{ // var battle = _context.Battles.Include(b => b.Samurais).FirstOrDefault(); //} //private static void AddingNewSamuraiToAnExistingBattle() //{ // var battle = _context.Battles.FirstOrDefault(); // battle.Samurais.Add(new Samurai { Name = "Takeda shingen" }); // _context.SaveChanges(); //} //private static void ModifyingRelatedDataWhenNotTracked() //{ // var samurai = _context.Samurais.Include(s => s.Quotes) // eager loading // .FirstOrDefault(s => s.Id == 1); // var quote = samurai.Quotes[0]; // quote.Text += "Did you hear that again?"; // using var newContext = new SamuraiContext(); // //newContext.Quotes.Update(quote); // all quotes of that samurai get updated! // newContext.Entry(quote).State = EntityState.Modified; // only this quote gets updated // newContext.SaveChanges(); //} //private static void ModifyingRelatedDataWhenTracked() //{ // var samurai = _context.Samurais.Include(s => s.Quotes) // eager loading // .FirstOrDefault(s => s.Id == 2); // samurai.Quotes[0].Text = "Did you hear that?"; // if quotes not loaded, get index out of range error // _context.SaveChanges(); //} //private static void FilteringWithRelatedData() //{ // var samurais = _context.Samurais // .Where(s => s.Quotes.Any(q => q.Text.Contains("happy"))) // Quotes won't get returned // .ToList(); //} //private static void ExplicitLoadQuotes() //{ // // make sure there's a horse in the DB, then clear the context's change tracker // _context.Set<Horse>().Add(new Horse { SamuraiId = 1, Name = "Mr. Ed" }); // _context.SaveChanges(); // _context.ChangeTracker.Clear(); // // ------ // var samurai = _context.Samurais.Find(1); // _context.Entry(samurai).Collection(s => s.Quotes).Load(); // _context.Entry(samurai).Reference(s => s.Horse).Load(); //} //private static void ProjectSamuraisWithQuotes() //{ // //var somePropsWithQuotes = _context.Samurais // //.Select(s => new { s.Id, s.Name, s.Quotes }) // //.Select(s => new { s.Id, s.Name, NumberOfQuotes = s.Quotes.Count }) // //.Select(s => new { s.Id, s.Name, HappyQuotes = s.Quotes.Where(q => q.Text.Contains("happy")) }) // //.ToList(); // var samuraisAndQuotes = _context.Samurais // .Select(s => new { Samurai = s, HappyQuotes = s.Quotes.Where(q => q.Text.Contains("happy")) }) // .ToList(); // var firstSamurai = samuraisAndQuotes[0].Samurai.Name += " The happiest"; //} //private static void ProjectSomeProperties() //{ // var somePropertyies = _context.Samurais.Select(s => new { s.Id, s.Name }).ToList(); // anonymous type // var idAndNames = _context.Samurais.Select(s => new IdAndName(s.Id, s.Name)).ToList(); // dynamic type //} //public struct IdAndName //{ // public int Id; // public string Name; // public IdAndName(int id, string name) // { // Id = id; // Name = name; // } //} //private static void EagerLoadSamuraiWithQuotes() //{ // //var samuraiWithQuotes = _context.Samurais.Include(s => s.Quotes).ToList(); // uses LeftJoin // //var splitQuery = _context.Samurais.AsSplitQuery().Include(s => s.Quotes).ToList(); // select from samurais, then inner join // var filteredInclude = _context.Samurais.Include(s => s.Quotes.Where(q => q.Text.Contains("Thanks"))).ToList(); //} //private static void Simpler_AddQuoteToExistingSamuraiNotTracked(int samuraiId) //{ // var quote = new Quote { Text = "Thanks for dinner!", SamuraiId = samuraiId }; // using var newContext = new SamuraiContext(); // newContext.Quotes.Add(quote); // newContext.SaveChanges(); //} //private static void AddQuoteToExistingSamuraiNotTracked(int samuraiId) //{ // var samurai = _contextNT.Samurais.Find(samuraiId); // samurai.Quotes.Add(new Quote // { // Text = "Now that I saved you, will you feed me dinner?" // }); // using (var newContext = new SamuraiContext()) // { // //newContext.Samurais.Update(samurai); // this will update samurai as well // newContext.Samurais.Attach(samurai); // this will not update samurai // newContext.SaveChanges(); // } //} //private static void AddQuoteToExistingSamuraiWhileTracked() //{ // var samurai = _context.Samurais.FirstOrDefault(); // samurai.Quotes.Add(new Quote // { // Text = "I bet you're happy that I've saved you!" // }); // _context.SaveChanges(); //} //private static void InsertNewSamuraiWithManyQuotes() //{ // var samurai = new Samurai // { // Name = "Kyuzo", // Quotes = new List<Quote> // { // new Quote { Text = "Watch out for my sharp sword!" }, // new Quote { Text = "I told you to watch out for the sharp sword! Oh well!" } // } // }; // _context.Samurais.Add(samurai); // _context.SaveChanges(); //} //private static void InsertNewSamuraiWithAQuote() //{ // var samurai = new Samurai // { // Name = "Kambei Shimada", // Quotes = new List<Quote> // { // new Quote { Text = "I've come to save you" } // } // }; // _context.Samurais.Add(samurai); // _context.SaveChanges(); //} //private static void QueryAndUpdateBattles_Disconnected() //{ // List<Battle> disconnectedBattles; // using (var context1 = new SamuraiContext()) // { // disconnectedBattles = context1.Battles.ToList(); // } // context1 is disposed // disconnectedBattles.ForEach(b => // { // b.StartDate = new DateTime(1570, 01, 01); // b.EndDate = new DateTime(1570, 12, 1); // }); // using (var context2 = new SamuraiContext()) // { // context2.UpdateRange(disconnectedBattles); // you must call update in a disconnected context // context2.SaveChanges(); // name get also updated in sql, because EF core knows about the update, but not what get updated // } //} //private static void RetrieveAndDeleteASamurai() //{ // var samurai = _context.Samurais.Find(15); // let context know and start tracking it // PrintSamurais(samurai); // _context.Samurais.Remove(samurai); // delete // PrintSamurais(samurai); // _context.SaveChanges(); // SaveChanges // PrintSamurais(samurai); // 15 Shino - so you can still print it after deleted //} //private static void MultipleDatabaseOperations() //{ // var samurai = _context.Samurais.FirstOrDefault(); // samurai.Name += "San"; // _context.Samurais.Add(new Samurai { Name = "Shino" }); // _context.SaveChanges(); //} //private static void RetrieveAndUpdateMultipleSamurais() //{ // var samurais = _context.Samurais.Skip(1).Take(4).ToList(); // PrintSamurais(samurais); // samurais.ForEach(s => s.Name += "San"); // PrintSamurais(samurais); // _context.SaveChanges(); //} //private static void RetrieveAndUpdateSamurai() //{ // var samurai = _context.Samurais.FirstOrDefault(); // PrintSamurais(samurai); // samurai.Name += "San"; // PrintSamurais(samurai); // _context.SaveChanges(); // PrintSamurais(samurai); //} //private static void QueryAggregates() //{ // var name = "Sampson"; // //var samurai = _context.Samurais.Where(s => s.Name == name).FirstOrDefault(); // var samurai = _context.Samurais.FirstOrDefault(s => s.Name == name); // PrintSamurais(samurai); // samurai = _context.Samurais.Find(2); // this isn't a Linq query, it is a DbSet method that gets executed directly // // if key is found in change tracker, avoids unneeded db query // PrintSamurais(samurai); //} //private static void QueryFilters() //{ // //var name = "Sampson"; // //var samurais = _context.Samurais.Where(s => s.Name == name).ToList(); // parameter is created in sql because search value is in a variable // //var samurais = _context.Samurais.Where(s => s.Name == "Sampson").ToList(); // no parameter is created in sql, because search value is directly in query // var samurais = _context.Samurais.Where(s => EF.Functions.Like(s.Name, "J%")).ToList(); // PrintSamurais(samurais); //} //private static void AddVariousTypes() //{ // _context.AddRange(new Samurai { Name = "Shimada" }, // new Samurai { Name = "Okamoto" }, // new Battle { Name = "Battle of Anegawa" }, // new Battle { Name = "Battle of Nagashino" }); // //_context.Samurais.AddRange( // // new Samurai { Name = "Shimada" }, // // new Samurai { Name = "Okamoto" }); // //_context.Battles.AddRange( // // new Battle { Name = "Battle of Anegawa" }, // // new Battle { Name = "Battle of Nagashino" }); // _context.SaveChanges(); //} private static void AddSamuraisByName(params string[] names) { //foreach (string name in names) //{ // _context.Samurais.Add(new Samurai { Name = name }); // add the samurai object to the context samurai DbSet, so it's an in memory collection of samurais that the context keeps track of //} //_context.SaveChanges(); // will save the data that the context is tracking back to the database var _bizData = new BusinessDataLogic(); var newSamuraisCreatedCount = _bizData.AddSamuraisByName(names); }
private static void AddSamuraiByName(params string[] names) { //Refactored out to BusinessDataLogic() //foreach (string name in names) //{ // _context.Samurais.Add(new Samurai { Name = name }); //} //_context.SaveChanges(); var _bizData = new BusinessDataLogic(); var newSamuraisCreatedCount = _bizData.AddSamuraisByName(names); }
public void AddMultipleSamuraisReturnsCorrectNumberOfInsertedRows() { var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("AddMultipleSamurais"); using (var context = new SamuraiContext(builder.Options)) { var bizLogic = new BusinessDataLogic(context); var nameList = new string[] { "Kikuchiyo", "Kyuzo", "Rikchi" }; var result = bizLogic.AddMultipleSamurais(nameList); Assert.AreEqual(nameList.Count(), result); } }
public void AddMultipleSamuraisCheckCount() { var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("AddMultipleSamuraisCheckCount"); using (var context = new SamuraiContext(builder.Options)) { var busLogic = new BusinessDataLogic(context); string[] names = { "Bob", "Pete", "John" }; var count = busLogic.AddSamurais(names); Assert.AreEqual(names.Length, count); } }
public void InsertUsingBusinessLogic() { var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("CanInsertMultipleSamurais"); using (var context = new SamuraiContext(builder.Options)) { var bz = new BusinessDataLogic(); var namesList = new string[] { "Alex", "Vlad", "Iulian" }; var result = bz.InsertSamurai(namesList); Assert.AreEqual(namesList.Count(), result); } }
public void CanAddSamuraisByName() { var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("CanAddSamuraisByName"); using var context = new SamuraiContext(builder.Options); var bizLogic = new BusinessDataLogic(context); var namelist = new string[] { "Kikuchiyo", "Kyuzo", "Rikchi" }; var result = bizLogic.AddSamuraisByName(namelist); Assert.AreEqual(namelist.Length, result); }
public void CanInsertSingleSamurai() { var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("InsertNewSamurai"); using (var context = new SamuraiContext(builder.Options)) { var bizlogic = new BusinessDataLogic(context); bizlogic.InsertNewSamurai(new Samurai()); }; using (var context2 = new SamuraiContext(builder.Options)) { Assert.AreEqual(1, context2.Samurais.Count()); } }
public void CanAddSamuraisByName() { var optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase("CanAddSamuraisByName"); var ctx = new SamuraiContext(optionsBuilder.Options); var businessLogic = new BusinessDataLogic(ctx); var names = new string[] { "John", "Harry", "James", "Michael" }; var result = businessLogic.AddSamuraisByName(names); Assert.AreEqual(names.Length, result); }
public void CanInsertSingleDirectory() { //UsInMemoryDatabase() needs a string to be passed in to give a name to that instance //It's how EF Core keeps track of different instances of the provider in memory. builder.UseInMemoryDatabase("InsertSingleDirectory"); using (var context = new FileSystemContext(builder.Options)) { var bizlogic = new BusinessDataLogic(context); bizlogic.MkDir(new Directory()); } using (var context2 = new FileSystemContext(builder.Options)) { Assert.Equal(1, context2.Directories.Count()); } }
public void BizDataGetSamuraiReturnsSamurai() { //Arrange (set up builder & seed data) var builder = new DbContextOptionsBuilder <SamuraiContext>(); builder.UseInMemoryDatabase("GetSamurai"); int samuraiId = SeedWithOneSamurai(builder.Options); //Act (call the method) using (var context = new SamuraiContext(builder.Options)) { var bizlogic = new BusinessDataLogic(context); var samuraiRetrieved = bizlogic.GetSamuraiById(samuraiId); //Assert (check the results) Assert.AreEqual(samuraiId, samuraiRetrieved.Result.Id); }; }
public void CanInsertSingleSamurai() { var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("InsertNewSamurai"); using (var context = new SamuraiContext(builder.Options)) { var bizlogic = new BusinessDataLogic(context); bizlogic.InsertNewSamurai(new Samurai()); } using (var context2 = new SamuraiContext(builder.Options)) { //Since we use the same DB for two distinct contexts the count //of the Samurais DbSet (or the number of Samurais in the DB) //should be the same in each context after insert Assert.AreEqual(1, context2.Samurais.Count()); } }
public void CanInsertSingleMethod() { var optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase("CanInsertSingleMethod"); using (var ctx = new SamuraiContext(optionsBuilder.Options)) { var businessLogic = new BusinessDataLogic(ctx); var samurai = new Samurai { Name = "Tommy" }; var result = businessLogic.InsertNewSamurai(samurai); } // Use different context to same Db instance using (var ctx2 = new SamuraiContext(optionsBuilder.Options)) { Assert.AreEqual(1, ctx2.Samurais.Count()); } }
public void ThrowsExceptionForDuplicateDirectory() { builder.UseInMemoryDatabase("ThrowsException"); using (var context = new FileSystemContext(builder.Options)) { context.Database.EnsureCreated(); var bizlogic = new BusinessDataLogic(context); var dir = new Directory() { Name = "Exception Directory", DirectoryId = 1 }; context.Directories.Add(dir); context.SaveChanges(); Assert.Throws <Exception>(() => bizlogic.AlreadyExists("Exception Directory", 1)); } }
public void CreateSamuraiCheck() { var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("CreateSamuraiCheck"); using (var context = new SamuraiContext(builder.Options)) { var busLogic = new BusinessDataLogic(context); var sam = new Samurai() { Name = "Ugly" }; var count = busLogic.CreateSamurai(sam); } using (var chkContext = new SamuraiContext(builder.Options)) { //var sam = chkContext.Samurais.FirstOrDefault(s => s.Id == 1); var sam = chkContext.Samurais.Find(1); Assert.AreEqual(sam.Name, "Ugly"); Assert.AreEqual(chkContext.Samurais.Count(), 1); } }
public void CanGetSamuraiWithQuotes() { int samuraiId; var builder = new DbContextOptionsBuilder(); // Teis question: won't the reuse of the InMemory db name 'SamuraiWithQuotes' // interfere with the previous test using the same name? // Answer: The database is shared across tests but they don't interefere with each other (bad practice though) builder.UseInMemoryDatabase("SamuraiWithQuotes"); using (var seedContext = new SamuraiConsoleContext(builder.Options)) { var samuraiGraph = new Samurai { Name = "Kyūzō", Quotes = new List <Quote> { new Quote { Text = "Watch out for my sharp sword" }, new Quote { Text = "I told you to watch out for my sharp sword! Oh well!" } } }; seedContext.Samurais.Add(samuraiGraph); seedContext.SaveChanges(); samuraiId = samuraiGraph.Id; } using (var context = new SamuraiConsoleContext(builder.Options)) { // Check if the InMemory database is shared across tests (it is): var samurais = context.Samurais.ToList(); var bizlogic = new BusinessDataLogic(context); var result = bizlogic.GetSamuraiWithQuotes(samuraiId); Assert.AreEqual(2, result.Quotes.Count); } }
// private readonly SamuraiContext _context; public SamuraisSoCController(BusinessDataLogic businessLogic) { _businessLogic = businessLogic; }
private static void AddSamuraisByName(params string[] names) { var _bizData = new BusinessDataLogic(); var newSamuraisCreatedCount = _bizData.AddSamuraisByName(names); }