Пример #1
0
        public void LinkFileTest_Destination_Exists()
        {
            string source      = @"LinkFileTest\LinkFileTest_Destination_Exists.txt";
            string destination = @"LinkFileTest\Exists\LinkFileTest_Destination_Exists.txt";

            Assert.ThrowsException <DestinationFileExistsException>(() => LinkCreator.LinkFile(source, destination));
            Assert.AreNotEqual(ReadFileContents(source), ReadFileContents(destination));
        }
Пример #2
0
        public void LinkFileTest_Source_DoesNotExist()
        {
            string source      = @"LinkFileTest\LinkFileTest_Source_DoesNotExist.txt";
            string destination = @"LinkFileTest\Exists\LinkFileTest_Destination_Exists.txt";

            Assert.IsFalse(File.Exists(source));
            Assert.ThrowsException <SourceFileNotFoundException>(() => LinkCreator.LinkFile(source, destination));
        }
 public static MvcHtmlString Create(CongressVoting voting, string @class = null)
 {
     return(LinkCreator.Create(voting.GetName(),
                               "ViewVoting",
                               "Congress",
                               new { votingID = voting.ID },
                               @class));
 }
Пример #4
0
 public static MvcHtmlString Create(Trade trade, string @class = null)
 {
     return(LinkCreator.Create(
                name: $"trade #{trade.ID}",
                action: "View",
                controller: "Trade",
                routeValues: new { tradeID = trade.ID }));
 }
Пример #5
0
        public void LinkFileTest_Destination_DoesNotExist()
        {
            string source      = @"LinkFileTest\LinkFileTest_Destination_DoesNotExist.txt";
            string destination = @"LinkFileTest\NotFound\LinkFileTest_Destination_DoesNotExist.txt";

            Assert.IsFalse(Directory.Exists(Path.GetDirectoryName(destination)));
            Assert.ThrowsException <DestinationDirectoryNotFoundException>(() => LinkCreator.LinkFile(source, destination));
        }
Пример #6
0
 public static MvcHtmlString Create(DevIssue issue, string @class = null)
 {
     return(LinkCreator.Create(
                name: issue.Name,
                action: "ViewIssue",
                controller: "DevIssue",
                routeValues: new { issueID = issue.ID }));
 }
Пример #7
0
        private void SendInviteWarning(Citizen citizen, Party party)
        {
            var partyLink    = EntityLinkCreator.Create(party.Entity).ToHtmlString();
            var partyInvites = LinkCreator.Create("party invites", "Invites", "Party");
            var message      = $"You were invited to {partyLink}. See {partyInvites} to accept or decline invite.";

            using (NoSaveChanges)
                warningService.AddWarning(citizen.ID, message);
        }
Пример #8
0
 private void startButton_Click(object sender, EventArgs e)
 {
     progressBar.Value = 0;
     if (moveToDest)
     {
         LinkCreator.createSymbolicLinkAndMove(destinationPath, targetPath, linkType);
     }
     else
     {
         LinkCreator.createSymbolicLink(destinationPath, targetPath, linkType);
     }
 }
Пример #9
0
        public void LinkFileTest_Modification_Destination()
        {
            string source      = @"LinkFileTest\LinkFileTest_Modification_Destination.txt";
            string destination = @"LinkFileTest\Success\LinkFileTest_Modification_Destination.txt";

            CleanDestinationDirectory(source, destination);
            LinkCreator.LinkFile(source, destination);
            Assert.IsTrue(File.Exists(source));
            Assert.IsTrue(File.Exists(destination));
            Assert.AreEqual(ReadFileContents(source), ReadFileContents(destination));
            using (var writer = new StreamWriter(destination, true))
            {
                writer.WriteLine("I really hope that this also works cause that'd be cool");
            }
            Assert.AreEqual(ReadFileContents(source), ReadFileContents(destination));
        }
Пример #10
0
        public void LinkFileTest()
        {
            string source      = @"LinkFileTest\LinkFileTest_NoModification.txt";
            string destination = @"LinkFileTest\Success\LinkFileTest_NoModification.txt";

            CleanDestinationDirectory(source, destination);
            LinkCreator.LinkFile(source, destination);
            Assert.IsTrue(File.Exists(source));
            Assert.IsTrue(File.Exists(destination));
            Assert.AreEqual(ReadFileContents(source), ReadFileContents(destination));
            File.Delete(source);
            Assert.IsFalse(File.Exists(source));
            Assert.IsTrue(File.Exists(destination));
            File.Delete(destination);
            Assert.IsFalse(File.Exists(destination));
        }
Пример #11
0
        public async Task <HttpResponseMessage> Get(int page = DefaultPage, int pageSize = MaxPageSize)
        {
            var detailLink = new LinkCreator(this.Url, "CustomerDetails");
            var listLink   = new LinkCreator(this.Url, "All");

            var totalCount = await this.customerQuery
                             .GetCustomerCountAsync()
                             .ConfigureAwait(false);

            var customers = await this.customerQuery
                            .FindAsync(c => detailLink.Create(new { customerId = c.CustomerId }), page, pageSize)
                            .ConfigureAwait(false);

            return(Request.CreateResponse(
                       HttpStatusCode.OK,
                       new ResourceCollection <CustomerListModel>(listLink, customers, totalCount, page, pageSize)));
        }
Пример #12
0
        static void Main(string[] args)
        {
            Console.WriteLine("Source: ");
            var source = Console.ReadLine();

            Console.WriteLine("Destination: ");
            var destination = Console.ReadLine();

            while (!string.IsNullOrEmpty(source.Trim()) && !string.IsNullOrEmpty(destination.Trim()))
            {
                LinkCreator.LinkDirectory(source, destination);

                Console.WriteLine("Source: ");
                source = Console.ReadLine();
                Console.WriteLine("Destination: ");
                destination = Console.ReadLine();
            }
        }
Пример #13
0
        public void SendJoinRequest(Citizen citizen, Party party, string message)
        {
            var request = new PartyJoinRequest()
            {
                Day       = GameHelper.CurrentDay,
                CitizenID = citizen.ID,
                DateTime  = DateTime.Now,
                PartyID   = party.ID,
                Message   = message
            };
            var citizenLink  = EntityLinkCreator.Create(citizen.Entity);
            var requestsLink = LinkCreator.Create("join requests", "JoinRequests", "Party", new { partyID = party.ID });

            var warningMessage = $"{citizenLink} send join requests. You can see actual {requestsLink} to accept or decline them.";

            using (NoSaveChanges)
                warningService.AddWarning(party.ID, warningMessage);

            partyJoinRequestRepository.Add(request);
            ConditionalSaveChanges(partyJoinRequestRepository);
        }
Пример #14
0
        public void LinkDirectoryTest()
        {
            string source      = @"LinkDirectoryTest";
            string destination = @"LinkDirectory";

            Assert.IsTrue(Directory.Exists(source));
            if (Directory.Exists(destination))
            {
                Directory.Delete(destination);
            }
            Assert.IsFalse(Directory.Exists(destination));
            Assert.IsTrue(LinkCreator.LinkDirectory(source, destination));
            Assert.IsTrue(Directory.Exists(destination));
            var srcFiles  = Directory.GetFiles(source);
            var destFiles = Directory.GetFiles(destination);

            Assert.AreEqual(srcFiles.Length, destFiles.Length);
            for (int i = 0; i < srcFiles.Length; i++)
            {
                Assert.AreEqual(Path.GetFileName(srcFiles[i]), Path.GetFileName(destFiles[i]));
            }
            Directory.Delete(destination);
            Assert.IsFalse(Directory.Exists(destination));
        }
Пример #15
0
 public static MvcHtmlString Create(Region region, string @class = null)
 {
     return(LinkCreator.Create(region.Name, "View", "Region", new { regionID = region.ID }, @class));
 }
Пример #16
0
 private void retainExecutables_CheckedChanged(object sender, EventArgs e)
 {
     LinkCreator.completeLinkStep(new EventArgs());
 }
Пример #17
0
        public static MvcHtmlString Create(War war, string @class = null)
        {
            string name = (war.IsRessistanceWar ? "ressistance " : "") + "war";

            return(LinkCreator.Create($"{name} #{war.ID}", "view", "war", new { warID = war.ID }, @class));
        }