Esempio n. 1
0
        public void IntOrNext()
        {
            var counter = new GuidCounter();
            var newGuid = Guid.NewGuid();
            var one     = counter.IntOrNext(newGuid);
            var two     = counter.IntOrNext(newGuid);

            Assert.Equal(one, two);
        }
Esempio n. 2
0
    public int IntOrNext <T>(T input)
    {
        if (input is Guid guidInput)
        {
            return(GuidCounter.IntOrNext(guidInput));
        }

        if (input is DateTime dateTimeInput)
        {
            return(DateTimeCounter.IntOrNext(dateTimeInput));
        }

        if (input is DateTimeOffset dateTimeOffsetInput)
        {
            return(DateTimeOffsetCounter.IntOrNext(dateTimeOffsetInput));
        }

        throw new Exception($"Unknown type {typeof(T).FullName}");
    }