コード例 #1
0
        public void GetKey_When_Id_Set_Returns_Key_Containing_Id()
        {
            // Arrange
            var expected = Random.Long();

            // Act & Assert
            CacheKeys.GetKey <CultureStub>(id: expected).ShouldContain(expected.ToString());
        }
コード例 #2
0
        public void GetKey_When_Id_Set_Returns_Key_Containing_Type()
        {
            // Arrange
            var id = Random.Long();

            // Act
            var result = CacheKeys.GetKey <CultureStub>(id);

            // Assert
            result.ShouldContain(nameof(CultureStub));
        }
コード例 #3
0
        public void GetKey_When_Include_Properties_Set_Returns_Key_Containing_Sorted_Properties()
        {
            // Arrange
            var delimiter         = "-";
            var includeProperties = new List <Expression <Func <CultureStub, object> > >
            {
                e => e.IsDefault, // <--- intentionally out of sort order
                e => e.Code
            };

            // Act
            var result = CacheKeys.GetKey <CultureStub>(
                id: Random.Long(),
                delimiter: delimiter,
                includeProperties: includeProperties
                );

            // Assert
            result.ShouldContain($"Code{delimiter}IsDefault");
        }
コード例 #4
0
 public void GetKey_When_Id_Set_Returns_Key_Containing_Type()
 {
     CacheKeys.GetKey <CultureStub>(id: Random.Long()).ShouldContain(typeof(CultureStub).Name);
 }