public void Execute_Should_Launch_File_When_Only_User_Lock_Present() { FileSystem.AddFile(TestFileName, new Bogus.Faker().Lorem.Paragraphs(3)); var launchLock = new Library.LaunchLock() { IsValid = true, FileName = $"{TestFileName}.{Guid.NewGuid()}.launchlock", Username = System.Security.Principal.WindowsIdentity.GetCurrent().Name, LockTime = DateTime.Now }; var launchLockJson = JsonOperations.Serialize(launchLock); FileSystem.AddFile(launchLock.FileName, launchLockJson); LaunchLockProcess.Execute(new string[] { TestFileName }); Communicator.Messages.Should().Contain("Launching file."); }
public void Deserialize_Should_Work_For_Valid_Input() { var lockTime = DateTime.Now; var userName = new Bogus.Faker().Internet.UserName(); var originalLaunchLock = new LaunchLock() { FileName = FileName, Username = userName, LockTime = lockTime, IsValid = true }; var input = JsonOperations.Serialize(originalLaunchLock); var launchLock = JsonOperations.Deserialize(FileName, input); launchLock.IsValid.Should().Be(true); launchLock.FileName.Should().Be(FileName); launchLock.LockTime.Should().BeCloseTo(lockTime); launchLock.Username.Should().Be(userName); }