Beispiel #1
0
 public void IsSingleton_NotSingletonObject_ReturnsFalse()
 {
     SingletonTester
     .IsSingleton(() => new object())
     .Should()
     .BeFalse();
 }
Beispiel #2
0
        public void IsSingleton_PassASingleton_ReturnsTrue()
        {
            var isSingleton = SingletonTester.IsSingleton(
                SingletonTesterData.GetSingletonObject);

            Assert.That(isSingleton, Is.EqualTo(true));
        }
Beispiel #3
0
 public void IsSingleton_SingletonObject_ReturnsTrue()
 {
     SingletonTester
     .IsSingleton(() => SafeSingleton.Instance)
     .Should()
     .BeTrue();
 }
Beispiel #4
0
        public void IsSingleton_PassANonSingleton_ReturnsFalse()
        {
            var isSingleton = SingletonTester.IsSingleton(
                SingletonTesterData.GetNonSingletonObject);

            Assert.That(isSingleton, Is.EqualTo(false));
        }
Beispiel #5
0
            public void Test()
            {
                var obj = new object();

                Assert.IsTrue(SingletonTester.IsSingleton(() => obj));
                Assert.IsFalse(SingletonTester.IsSingleton(() => new object()));
            }
Beispiel #6
0
        public void IsSingletonTest()
        {
            // Arrange

            // Act
            var actual = SingletonTester.IsSingleton(() => SingletonDatabase.Instance);

            // Assert
            Assert.IsTrue(actual);
        }
 static void Main(string[] args)
 {
     Console.WriteLine(SingletonTester.IsSingleton(CreateNonSingletonPerson));
     Console.WriteLine(SingletonTester.IsSingleton(CreateSingletonPerson));
 }
 static void Main(string[] args)
 {
     Console.WriteLine(SingletonTester.IsSingleton(() => { return(new List <string>()); }));
 }