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); } }
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); }
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); }
public void Feature_Empty_PropertyReturnsAreCorrect() { UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe"); License license = new License() { Port = MockUtil.Program.NoDelayPort, Host = "LmStatTest" }; license.GetStatus(); string expectedName = "Empty_Feature_One_License"; Feature target = license.Features.First(f => f.Name == expectedName); PropertiesComparer.AssertFeaturePropertiesAreEqual( actual: target, name: expectedName, quantityIssued: 1, quantityUsed: 0, quantityAvailable: 1, quantityBorrowed: 0, usersCount: 0, vendor: null, version: null, type: null, inUse: false, hasError: false, errorMessage: null, entryIndex: 450 + indexOffset, entryLength: 97); }
public void Feature_Error_PropertyReturnsAreCorrect() { UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe"); License license = new License() { Port = MockUtil.Program.NoDelayPort, Host = "LmStatTest" }; license.GetStatus(); string expectedName = "Feature_With_Error"; Feature target = license.Features.First(f => f.Name == expectedName); PropertiesComparer.AssertFeaturePropertiesAreEqual( actual: target, name: expectedName, quantityIssued: 0, quantityUsed: 0, quantityAvailable: 0, quantityBorrowed: 0, usersCount: 0, vendor: null, version: null, type: null, inUse: false, hasError: true, errorMessage: "Cannot get users of Feature_With_Error: No such feature exists. (-5,222)", entryIndex: 802 + (2 * indexOffset), entryLength: 105); }
public void Feature_UserMultipleCheckouts_PropertyReturnsAreCorrect() { UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe"); License license = new License() { Port = MockUtil.Program.NoDelayPort, Host = "LmStatTest" }; license.GetStatus(); string expectedName = "User_Multiple_Checkouts"; Feature target = license.Features.First(f => f.Name == expectedName); PropertiesComparer.AssertFeaturePropertiesAreEqual( actual: target, name: expectedName, quantityIssued: 9, quantityUsed: 8, quantityAvailable: 1, quantityBorrowed: 2, usersCount: 4, vendor: "testdaemon", version: "v22.0", type: "floating license", inUse: true, hasError: false, errorMessage: null, entryIndex: target.EntryIndex, entryLength: 553 + (4 * indexOffset)); }
public void License_GetStatusFromConnect_PropertyReturnsAreCorrect() { UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe"); License target = new License() { Port = 7601, Host = "LmStatConnect" }; target.GetStatus(); PropertiesComparer.AssertLicensePropertiesAreEqual( actual: target, time: DateTime.Today.AddHours(14).AddMinutes(25), serverFile: null, vendorDaemonName: string.Empty, vendorDaemonStatus: string.Empty, vendorDaemonVersion: string.Empty, isVendorDaemonUp: false, featuresCount: 0, isFeatureError: false, userCount: 0, inUse: false, inUseCount: 0, hasError: true, errorMessage: "Cannot connect to license server system. (-15,10:10061 \"WinSock: Connection refused\")", isBusy: false); }
public void License_GetStatusFromErrors_PropertyReturnsAreCorrect() { UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe"); License target = new License() { Port = 7601, Host = "LmStatErrors" }; target.GetStatus(); PropertiesComparer.AssertLicensePropertiesAreEqual( actual: target, time: new DateTime(2008, 11, 20, 15, 42, 0), serverFile: @"D:\License Servers\Theorem\theorem.dat", vendorDaemonName: "theorem", vendorDaemonStatus: "The desired vendor daemon is down. (-97,121)", vendorDaemonVersion: string.Empty, isVendorDaemonUp: false, featuresCount: 11, isFeatureError: true, userCount: 0, inUse: false, inUseCount: 0, hasError: false, errorMessage: string.Empty, isBusy: false); }
public void License_SecondGetStatus_PropertyReturnsAreCorrect() { UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe"); License target = new License() { Port = 27001, Host = "LmStatNX" }; target.GetStatus(); target.Port = 27005; target.Host = "LmStatAcad"; target.GetStatus(); PropertiesComparer.AssertLicensePropertiesAreEqual( actual: target, time: DateTime.Today.AddHours(10).AddMinutes(43), serverFile: @"C:\License Servers\Autodesk\Autodesk.dat", vendorDaemonName: "adskflex", vendorDaemonStatus: "UP", vendorDaemonVersion: "v10.8", isVendorDaemonUp: true, featuresCount: 22, isFeatureError: false, userCount: 112, inUse: true, inUseCount: 7, hasError: false, errorMessage: string.Empty, isBusy: false); }
public void License_GetStatusFromTestUsingDifferentCultures_PropertyReturnsAreCorrect() { UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe"); foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures)) { Thread.CurrentThread.CurrentCulture = culture; License target = new License() { Port = MockUtil.Program.NoDelayPort, Host = "LmStatTest" }; target.GetStatus(); PropertiesComparer.AssertLicensePropertiesAreEqual( actual: target, time: DateTime.Today.AddHours(10).AddMinutes(43), serverFile: @"C:\License Servers\Test\Test.lic", vendorDaemonName: "testdaemon", vendorDaemonStatus: "UP", vendorDaemonVersion: "v10.1", isVendorDaemonUp: true, featuresCount: 13, isFeatureError: true, userCount: 67, inUse: true, inUseCount: 10, hasError: false, errorMessage: string.Empty, isBusy: false); } }
public void License_Initialized_PropertyReturnsAreCorrect() { License target = new License(); PropertiesComparer.AssertLicensePropertiesAreEqual( actual: target, time: DateTime.MinValue, serverFile: null, vendorDaemonName: null, vendorDaemonStatus: null, vendorDaemonVersion: null, isVendorDaemonUp: false, featuresCount: 0, isFeatureError: false, userCount: 0, inUse: false, inUseCount: 0, hasError: false, errorMessage: null, isBusy: false); Assert.IsNull(target.Report, "Report property"); }
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); } }