示例#1
0
        public async Task GetNameById_WithInvalidData_ShouldWorkCorrectly(int?id)
        {
            var context = WilderExperienceContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            var repository = new EfDeletableEntityRepository <Location>(context);
            var service    = new LocationsService(repository);


            var name = service.GetNameById(id);

            Assert.Null(name);
        }
示例#2
0
        public async Task GetNameById_ShouldWorkCorrectly()
        {
            var context = WilderExperienceContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            var repository = new EfDeletableEntityRepository <Location>(context);
            var service    = new LocationsService(repository);

            var firstLocation = context.Locations.First();
            var expectedName  = firstLocation.Name;
            var id            = firstLocation.Id;

            var actualName = service.GetNameById(id);

            Assert.True(expectedName == actualName);
        }