Exemple #1
0
 public PlanetControllerTests()
 {
     _cache    = new Mock <IPlanetCache>();
     _mediator = new Mock <IMediator>();
     _planet   = new GetPlanetModel
     {
         Id             = Guid.NewGuid(),
         Name           = "Planet 1",
         Introduction   = "Introduction",
         Description    = "Description",
         Density        = 1.0,
         Tilt           = 1.0,
         ImageUrl       = "ImageUrl",
         RotationPeriod = 1.0,
         Period         = 1.0,
         Radius         = 1,
         Moons          = 1,
         Au             = 1.1,
         Eccentricity   = 1.2,
         Velocity       = 1.3,
         Mass           = 1.4,
         Inclination    = 1.5,
         Type           = "PlanetType",
         Ordinal        = 1
     };
 }
        public void Set(GetPlanetModel planet)
        {
            var cacheEntryOptions = new MemoryCacheEntryOptions().SetSize(1);

            Cache.Set(GetCacheKey(planet.Id), planet, cacheEntryOptions);
            Cache.Set(GetCacheKey(planet.Name), planet, cacheEntryOptions);
        }