Exemplo n.º 1
0
        public void User_NameDisplayWithSpaces_PropertyReturnsAreCorrect()
        {
            UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe");
            License license = new License()
            {
                Port = MockUtil.Program.NoDelayPort, Host = "LmStatTest"
            };

            license.GetStatus();

            Feature feature = license.Features.First(f => f.Name == "Users_With_Spaces_Auto");

            foreach (User user in feature.Users)
            {
                bool expectedIdentity = user.Name.First() == 'u' && user.Host.First() == 'h' && user.Display.First() == 'd';
                Assert.IsTrue(expectedIdentity, "Name, Host and/or Display are incorrect.");

                PropertiesComparer.AssertUserPropertiesAreEqual(
                    actual: user,
                    name: user.Name,
                    host: user.Host,
                    display: user.Display,
                    version: "v22.0",
                    server: "SERVER001",
                    port: 27001,
                    handle: 100,
                    time: DateTime.Today.AddHours(10).AddMinutes(21),
                    quantityused: 1,
                    linger: TimeSpan.Zero,
                    isBorrowed: false,
                    borrowEndTime: DateTime.MinValue,
                    entryIndex: user.EntryIndex,
                    entryLength: user.EntryLength);
            }
        }
Exemplo n.º 2
0
        public void User_Borrowed_PropertyReturnsAreCorrect()
        {
            UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe");
            License license = new License()
            {
                Port = MockUtil.Program.NoDelayPort, Host = "LmStatTest"
            };

            license.GetStatus();

            Feature feature = license.Features.First(f => f.Name == "Feature_With_Borrow");

            string expectedName = "user006";
            User   target       = feature.Users.First(u => u.Name == expectedName);

            DateTime expectedTime   = DateTime.Today.AddDays(-15).AddHours(11).AddMinutes(28);
            TimeSpan expectedLinger = TimeSpan.FromSeconds(14437140);

            PropertiesComparer.AssertUserPropertiesAreEqual(
                actual: target,
                name: expectedName,
                host: "comp006",
                display: "comp006",
                version: "v22.0",
                server: "SERVER001",
                port: 27001,
                handle: 6301,
                time: expectedTime,
                quantityused: 1,
                linger: expectedLinger,
                isBorrowed: true,
                borrowEndTime: expectedTime.AddSeconds(expectedLinger.TotalSeconds),
                entryIndex: 1429 + (5 * indexOffset),
                entryLength: target.EntryLength);
        }
Exemplo n.º 3
0
        public void User_OtherFormats_PropertyReturnsAreCorrect()
        {
            UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe");
            License license = new License()
            {
                Port = MockUtil.Program.NoDelayPort, Host = "LmStatTest"
            };

            license.GetStatus();

            Feature feature = license.Features.First(f => f.Name == "User_Multiple_Checkouts");

            string expectedName = "user011";
            User   target       = feature.Users.First(u => u.Name == expectedName);

            PropertiesComparer.AssertUserPropertiesAreEqual(
                actual: target,
                name: expectedName,
                host: "comp011",
                display: "comp011",
                version: "v22.0",
                server: "SERVER001",
                port: 27001,
                handle: 2209,
                time: DateTime.Today.AddHours(13).AddMinutes(21),
                quantityused: 2,
                linger: TimeSpan.Zero,
                isBorrowed: false,
                borrowEndTime: DateTime.MinValue,
                entryIndex: target.EntryIndex,
                entryLength: 88 + indexOffset);
        }
Exemplo n.º 4
0
        public void User_TypicalUsingDifferentCultures_PropertyReturnsAreCorrect()
        {
            UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe");

            foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
            {
                Thread.CurrentThread.CurrentCulture = culture;

                License license = new License()
                {
                    Port = MockUtil.Program.NoDelayPort, Host = "LmStatTest"
                };
                license.GetStatus();

                Feature feature = license.Features.First(f => f.Name == "Feature_With_Borrow");

                string expectedName = "user003";
                User   target       = feature.Users.First(u => u.Name == expectedName);

                PropertiesComparer.AssertUserPropertiesAreEqual(
                    actual: target,
                    name: expectedName,
                    host: "comp003",
                    display: "comp003",
                    version: "v22.0",
                    server: "SERVER001",
                    port: 27001,
                    handle: 2009,
                    time: DateTime.Today.AddHours(10).AddMinutes(21),
                    quantityused: 1,
                    linger: TimeSpan.Zero,
                    isBorrowed: false,
                    borrowEndTime: DateTime.MinValue,
                    entryIndex: 1169 + (2 * indexOffset),
                    entryLength: 76 + indexOffset);
            }
        }