public GridSuperheroes(NavigationService navigationService, SuperheroesService superheroesService) { InitializeComponent(); this.navigationService = navigationService; this.superheroesService = superheroesService; }
public void ThrowArgumentException_WhenSuperheroNameIsLessThan3Characters() { //Arrange var service = new SuperheroesService(mockUnitOfWork, mockSuperheroes, mockPowers, mockCities); var superheroName = this.GetRandomString(2); //Act && Assert service.CreateSuperhero("SU", "Clark Kent", "Metropolis", null); }
public void GetAllSuperheroes_WhenThereAreSuperheroes() { var superherosList = new List<Superhero>() .AsQueryable(); Mock.Arrange(() => this.mockSuperheroes.Entities) .Returns(superherosList); var service = new SuperheroesService(this.mockUnitOfWork, this.mockSuperheroes, this.mockPowers, this.mockCities); var superheroes = service.GetAllSuperheroes() .ToList(); CollectionAssert.AreEqual(superherosList.ToList(), superheroes); }
public void GetAllSuperheroes_WhenThereAreSuperheroes() { var superherosList = new List <Superhero>() .AsQueryable(); Mock.Arrange(() => this.mockSuperheroes.Entities) .Returns(superherosList); var service = new SuperheroesService(this.mockUnitOfWork, this.mockSuperheroes, this.mockPowers, this.mockCities); var superheroes = service.GetAllSuperheroes() .ToList(); CollectionAssert.AreEqual(superherosList.ToList(), superheroes); }
public void CreateNewSuperhero_WhenDataIsValid() { //Arrange bool isCalled = false; Mock.Arrange(() => this.mockSuperheroes.Add(Arg.IsAny<Superhero>())) .DoInstead(() => isCalled = true); var service = new SuperheroesService(mockUnitOfWork, mockSuperheroes, mockPowers, mockCities); //Act service.CreateSuperhero("Superman", "Clark Kent", "Metropolis", new List<string>()); //Assert Assert.IsTrue(isCalled); }
public void CreateNewSuperhero_WhenDataIsValid() { //Arrange bool isCalled = false; Mock.Arrange(() => this.mockSuperheroes.Add(Arg.IsAny <Superhero>())) .DoInstead(() => isCalled = true); var service = new SuperheroesService(mockUnitOfWork, mockSuperheroes, mockPowers, mockCities); //Act service.CreateSuperhero("Superman", "Clark Kent", "Metropolis", new List <string>()); //Assert Assert.IsTrue(isCalled); }
public DetailSuperhero(SuperheroesService superheroesService) { InitializeComponent(); _superheroesService = superheroesService; }