public void AddGamer_GivenGamer_ShouldAddGamer() { //Arrange var agniKai = new AgniKai { Ticket = string.Empty }; var gamer = new AI { AgniKaiTicket = string.Empty, Name = "gamer_1" }; //Act agniKai.AddGamer(gamer); var result = agniKai.GetGamerByName("gamer_1"); //Assert result.ShouldBeEquivalentTo(gamer); }
public async Task CreateGamerWithNameAsync_GivenTicketAndName_ExpectGamerCreated() { //Arrange var agnikai = new AgniKai { Ticket = "Ticket" }; var mockDatabase = Substitute.For <IDatabaseRepository>(); mockDatabase.GetAgniKaiByTicketAsync(Arg.Any <string>()).Returns(Task.FromResult(agnikai)); var gamerRepo = new GamerRepository(mockDatabase); //Act await gamerRepo.CreateGamerWithNameAsync("Ticket", "Gamer-1"); var gamer = agnikai.GetGamerByName("Gamer-1"); //Assert await mockDatabase.Received(1).GetAgniKaiByTicketAsync("Ticket"); Assert.IsInstanceOf <AI>(gamer); }